Class NegativeCycleDetectedException

  • All Implemented Interfaces:
    Serializable

    public class NegativeCycleDetectedException
    extends RuntimeException
    An exception used to notify about the detection of a negative cycle. The exception may carry the negative cycle to the user.
    Author:
    Dimitrios Michail
    See Also:
    Serialized Form
    • Constructor Detail

      • NegativeCycleDetectedException

        public NegativeCycleDetectedException()
        Constructs a new exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable).
      • NegativeCycleDetectedException

        public NegativeCycleDetectedException​(String message)
        Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable).
        Parameters:
        message - the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
      • NegativeCycleDetectedException

        public NegativeCycleDetectedException​(String message,
                                              GraphPath<?,​?> cycle)
        Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable).
        Parameters:
        message - the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
        cycle - the negative weight cycle
    • Method Detail

      • getCycle

        public GraphPath<?,​?> getCycle()
        Get the actual negative cycle, or null if not provided.
        Returns:
        the negative cycle or null.
      • setCycle

        public void setCycle​(GraphPath<?,​?> cycle)
        Set the negative cycle.
        Parameters:
        cycle - the negative cycle.