Packagecom.yworks.graph.model
Classpublic class Hierarchies
InheritanceHierarchies Inheritance Object

Utility class that offers static convenience methods for often used tasks in conjunction with INodeHierarchy instances.



Public Methods
 MethodDefined By
  
[static] Returns all elements that are part of the hierarchy.
Hierarchies
  
[static] Returns all descendants of the provided item that are part of the hierarchy.
Hierarchies
  
[static] Returns all descendants of the provided item that are part of the hierarchy.
Hierarchies
  
[static] Determines the nearest common ancestor of the items provided in the hierarchy.
Hierarchies
  
[static] Gets the path to root traversing all parents of the given item.
Hierarchies
  
isDescendant(hierarchy:INodeHierarchy, node:INode, parent:INode):Boolean
[static] Determines whether parent is a parent of node
Hierarchies
Method Detail
elements()method
public static function elements(hierarchy:INodeHierarchy):Iterable

Returns all elements that are part of the hierarchy.

Parameters

hierarchy:INodeHierarchy — The hierarchy itself.

Returns
Iterable — An enumeration of the contents of the hierarchy at the time of this invokation.
getDescendants()method 
public static function getDescendants(hierarchy:INodeHierarchy, root:INode):Iterable

Returns all descendants of the provided item that are part of the hierarchy.

The enumeration will be top down, i.e. all of an item's ancestors will be enumerated before the respective item.

Parameters

hierarchy:INodeHierarchy — The hierarchy itself.
 
root:INode — The root item to get the descendants from.

Returns
Iterable — An enumeration of the children of the item at the time of this invocation in reverse dfs prefix order.
getDescendantsBottomUp()method 
public static function getDescendantsBottomUp(hierarchy:INodeHierarchy, root:INode):Iterable

Returns all descendants of the provided item that are part of the hierarchy.

The iteration will be bottom up, i.e. all of an item's children will be iterated before the respective item.

Parameters

hierarchy:INodeHierarchy — The hierarchy itself.
 
root:INode — The root item to get the descendants from.

Returns
Iterable — An iterable of the children of the item at the time of this invokation in dfs postfix order.
getNearestCommonAncestor()method 
public static function getNearestCommonAncestor(hierarchy:INodeHierarchy, items:Iterator):INode

Determines the nearest common ancestor of the items provided in the hierarchy.

Parameters

hierarchy:INodeHierarchy — The hierarchy itself.
 
items:Iterator — The items to find the nearest common ancestor of

Returns
INode
getPathToRoot()method 
public static function getPathToRoot(hierarchy:INodeHierarchy, node:INode):Iterable

Gets the path to root traversing all parents of the given item.

Parameters

hierarchy:INodeHierarchy — The hierarchy to use for retrieving the parents.
 
node:INode — The node to start.

Returns
Iterable — A list that includes the node but not the root, unless they are identical and all parents in between them.

See also

isDescendant()method 
public static function isDescendant(hierarchy:INodeHierarchy, node:INode, parent:INode):Boolean

Determines whether parent is a parent of node

Parameters

hierarchy:INodeHierarchy — The hierarchy itself.
 
node:INode — The node to check.
 
parent:INode — The parent to check.

Returns
Boolean — Whether parent is an ancestor of node.