站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

TopologicalSortException (NetBeans Utilities API) - NetBeans API Javadoc 5.0.0

 

org.openide.util
Class TopologicalSortException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byorg.openide.util.TopologicalSortException
All Implemented Interfaces:
Serializable

public final class TopologicalSortException
extends Exception

Exception that signals that a topological sort failed due to unsortable nature of the graph and that provides support for reporting and recovering from that state.

Since:
3.30
See Also:
Utilities.topologicalSort(java.util.Collection, java.util.Map), Serialized Form

Method Summary
 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.
 Set[] unsortableSets()
          The topological sort could not be finished as there are some objects that are mutually refering to each other.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

partialSort

public final List partialSort()
Because the full sort was not possible, this methods returns the best possible substitute for it that is available.

Returns:
list of partially sorted objects, the list can be freely modified

unsortableSets

public final Set[] unsortableSets()
The topological sort could not be finished as there are some objects that are mutually refering to each other. This methods finds such objects and partition them into separate sets. All objects in one set (transitively) refer to each other and thus prevent the sort from succeding. As there can be more of such "unsortable sets" an array of them is returned.

Returns:
array of sets that contain some of the original objects, result shall not be modified

printStackTrace

public final void printStackTrace(PrintWriter w)
Adds description why the graph cannot be sorted.

Parameters:
w - writer to write to

printStackTrace

public final void printStackTrace(PrintStream s)
Adds description why the graph cannot be sorted.

Parameters:
s - stream to write to

topologicalSets

public final Set[] topologicalSets()
As the full topological sort cannot be finished due to cycles in the graph this methods performs a partition topological sort.

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.

Returns:
array of sorted sets that contain the original objects, each object from the original collection is exactly in one set, result shall not be modified

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.