public final class TopologicalSortException extends Exception
Modifier and Type | Method and Description |
---|---|
String |
getMessage() |
List |
partialSort()
Because the full sort was not possible, this methods
returns the best possible substitute for it that is available.
|
void |
printStackTrace(PrintStream s)
Adds description why the graph cannot be sorted.
|
void |
printStackTrace(PrintWriter w)
Adds description why the graph cannot be sorted.
|
Set[] |
topologicalSets()
As the full topological sort cannot be finished due to cycles
in the graph this methods performs a partition topological sort.
|
String |
toString() |
Set[] |
unsortableSets()
The topological sort could not be finished as there
are some objects that are mutually refering to each other.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
public final List partialSort()
public final Set[] unsortableSets()
public String getMessage()
getMessage
in class Throwable
public final void printStackTrace(PrintWriter w)
printStackTrace
in class Throwable
w
- writer to write topublic final void printStackTrace(PrintStream s)
printStackTrace
in class Throwable
s
- stream to write topublic final Set[] topologicalSets()
First of all it identifies unsortable parts of the graph and partitions the graph into sets of original objects. Each set contains objects that are mutually unsortable (there is a cycle between them). Then the topological sort is performed again on those sets, this sort succeeds because the graph of sets is DAG (all problematic edges were only between objects now grouped inside the sets) and the result forms the return value of this method.