Package org.gcube.informationsystem.dag
Class Node<T>
java.lang.Object
org.gcube.informationsystem.dag.Node<T>
- Type Parameters:
T- The type of the element stored in the node.
- All Implemented Interfaces:
Comparable<Node<T>>
Represents a node in a
Dag.- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe children of this node.The elements of the children of this node.The DAG to which this node belongs.The elements of all descendants of this node.All descendants of this node.static StringThe string used for indentation when printing the DAG.The parents of this node -- aSet, not a single value: a node can legitimately have more than one (e.g. an interface extending two already-placed interfaces within the same hierarchy, real Java multiple inheritance), andaddChild(Node)is called once per matching parent.protected TThe element stored in this node. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a child to this node.intvoidelaborate(NodeElaborator<T> nodeElaborator) Traverses the sub-DAG rooted at this node and applies the given elaborator.protected voidelaborate(NodeElaborator<T> nodeElaborator, int level) Traverses the sub-DAG rooted at this node and applies the given elaborator.Returns the children of this node.Returns the elements of the children of this node.getDag()Returns the DAG to which this node belongs.Returns the elements of all descendants of this node.Returns all descendants of this node.Returns the identifier of this node's element.Returns the element stored in this node.Returns the parents of this node -- more than one for a node with genuine multiple inheritance within this hierarchy (seeparents), empty if this is a root.toString()
-
Field Details
-
INDENTATION
The string used for indentation when printing the DAG. -
t
The element stored in this node. -
dag
The DAG to which this node belongs. -
childrenElements
The elements of the children of this node. -
descendantElements
The elements of all descendants of this node. -
parents
The parents of this node -- aSet, not a single value: a node can legitimately have more than one (e.g. an interface extending two already-placed interfaces within the same hierarchy, real Java multiple inheritance), andaddChild(Node)is called once per matching parent. -
children
The children of this node. -
descendants
All descendants of this node.
-
-
Constructor Details
-
Node
Constructs a new node with the given element.- Parameters:
t- The element to store in the node.
-
-
Method Details
-
getDag
Returns the DAG to which this node belongs.- Returns:
- The parent DAG.
-
getNodeElement
Returns the element stored in this node.- Returns:
- The node's element.
-
getParents
Returns the parents of this node -- more than one for a node with genuine multiple inheritance within this hierarchy (seeparents), empty if this is a root.- Returns:
- The parent nodes.
-
addChild
Adds a child to this node.- Parameters:
child- The child node to add.- Returns:
- This node.
-
getIdentifier
Returns the identifier of this node's element.- Returns:
- The identifier.
-
getChildren
Returns the children of this node.- Returns:
- A set of child nodes.
-
getDescendants
Returns all descendants of this node.- Returns:
- A set of all descendant nodes.
-
getChildrenElements
Returns the elements of the children of this node.- Returns:
- A set of the elements of the child nodes.
-
getDescendantElements
Returns the elements of all descendants of this node.- Returns:
- A set of the elements of all descendant nodes.
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
elaborate
Traverses the sub-DAG rooted at this node and applies the given elaborator.- Parameters:
nodeElaborator- The elaborator to apply to each node.- Throws:
Exception- if an error occurs during elaboration.
-
elaborate
Traverses the sub-DAG rooted at this node and applies the given elaborator.- Parameters:
nodeElaborator- The elaborator to apply to each node.level- The current level in the DAG.- Throws:
Exception- if an error occurs during elaboration.
-