
TypeGraph is used to sort a set of types based on their dependencies on each other. A set of types cannot be sorted if the types have cyclic dependencies.
Slots
- addDependency
-
Void addDependency(Type from, Type to)
Add a dependency from the
from
type to theto
type. - addType
-
Add a type to the graph without specifying a dependency.
-
private TypeGraphNode node(Type nodeType)
Get the existing node for the specified type or create a new node if one does not already exist.
-
private Str:TypeGraphNode nodes
The list of nodes in the graph. A node wraps a Type and contains a child node for each dependent Type.
- rsort
-
Type[] rsort()
Get the list of types in the graph sorted in reverse order.
- sort
-
Type[] sort()
Get the list of types in the graph sorted by dependency. A type will always be later in the list than the types it depends on. That is, if type B depends on type A, the sorted result will be
[A, B]
.