Packagecom.yworks.graph.model
Classpublic class Hierarchies

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
  
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 invokation 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
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.