Class CycleDetectedException

All Implemented Interfaces:
OpenExceptionMeta, Serializable

public class CycleDetectedException extends TreeException
Cycle Detected Exception 循环检测异常

Exception thrown when a cycle is detected in tree.

在树中检测到循环时抛出的异常。

Features | 主要功能:

  • Cycle detection exception with path - 带路径的循环检测异常
  • Immutable cycle path storage - 不可变循环路径存储

Usage Examples | 使用示例:

try {
    CycleDetector.checkNoCycle(roots);
} catch (CycleDetectedException e) {
    List<?> cyclePath = e.getCyclePath();
}

Security | 安全性:

  • Thread-safe: Yes (immutable) - 是(不可变)
  • Null-safe: Yes (null path defaults to empty) - 是(null路径默认为空)
Since:
JDK 25, opencode-base-tree V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • CycleDetectedException

      public CycleDetectedException(String message)
    • CycleDetectedException

      public CycleDetectedException(List<?> cyclePath)
    • CycleDetectedException

      public CycleDetectedException(String message, List<?> cyclePath)
  • Method Details

    • getCyclePath

      public List<?> getCyclePath()
      Get the cycle path 获取循环路径
      Returns:
      the cycle path | 循环路径