Class CycleDetectedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.graph.exception.GraphException
cloud.opencode.base.graph.exception.CycleDetectedException
- All Implemented Interfaces:
Serializable
Cycle Detected Exception
检测到环异常
Exception thrown when a cycle is detected in a graph where cycles are not allowed.
当在不允许环的图中检测到环时抛出的异常。
Features | 主要功能:
- Carries the detected cycle vertices - 携带检测到的环顶点
- Extends
GraphExceptionwithGraphErrorCode.CYCLE_DETECTED- 使用CYCLE_DETECTED错误码扩展GraphException
Usage Examples | 使用示例:
try {
List<String> order = TopologicalSortUtil.sort(graph);
} catch (CycleDetectedException e) {
List<?> cycle = e.getCycle();
}
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: Yes (cycle may be null if not provided) - 空值安全: 是(未提供时cycle可能为null)
- Since:
- JDK 25, opencode-base-graph V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCycleDetectedException(String message) Create cycle detected exception with message 使用消息创建检测到环异常CycleDetectedException(List<?> cycle) Create cycle detected exception 创建检测到环异常 -
Method Summary
Methods inherited from class GraphException
getErrorCodeMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CycleDetectedException
Create cycle detected exception 创建检测到环异常- Parameters:
cycle- the detected cycle | 检测到的环
-
CycleDetectedException
Create cycle detected exception with message 使用消息创建检测到环异常- Parameters:
message- the error message | 错误消息
-
-
Method Details
-
getCycle
-