Package uk.blankaspect.common.basictree
Class NodeType
java.lang.Object
uk.blankaspect.common.basictree.NodeType
This class represents the type of a node. Node types form a hierarchy whose root is
ANY
, the node type of AbstractNode
. The hierarchy of node types mirrors the hierarchy of the classes with
which the node types are associated, so node types are likely to be useful only when it is inconvenient to work with
the classes of nodes.-
Field Summary
-
Constructor Summary
ConstructorDescriptionNodeType
(NodeType parent, Class<? extends AbstractNode> nodeClass) Creates a new node type that has the specified parent and is associated with the specified class of node. -
Method Summary
Modifier and TypeMethodDescriptionReturns an unmodifiable list of the child types of this node type.Class<? extends AbstractNode>
Returns the class of node with which this node type is associated.Returns the parent type of this node type.boolean
Returnstrue
if this node type is identical to or a subtype (ie, descendant) of the specified node type.boolean
Returnstrue
if this node type is identical to or a subtype (ie, descendant) of any of the specified node types.boolean
Returnstrue
if this node type is identical to or a subtype (ie, descendant) of any of the specified node types.toString()
Returns a string representation of this node type, which is the name of the class of node with which this node type is associated.
-
Field Details
-
ANY
The root of the node-type hierarchy.
-
-
Constructor Details
-
NodeType
Creates a new node type that has the specified parent and is associated with the specified class of node.- Parameters:
parent
- the parent of the node type.nodeClass
- the class of node with which the node type will be associated.- Throws:
IllegalArgumentException
- ifparent
isnull
ornodeClass
isnull
or- the node class of
parent
is not a superclass ofnodeClass
or parent
already has a child that is associated withnodeClass
.
-
-
Method Details
-
getParent
Returns the parent type of this node type. -
getChildren
Returns an unmodifiable list of the child types of this node type.- Specified by:
getChildren
in interfaceITreeNode<NodeType>
- Returns:
- an unmodifiable list of the child types of this node type.
-
toString
Returns a string representation of this node type, which is the name of the class of node with which this node type is associated. -
getNodeClass
Returns the class of node with which this node type is associated.- Returns:
- the class of node with which this node type is associated.
-
is
Returnstrue
if this node type is identical to or a subtype (ie, descendant) of the specified node type.- Parameters:
nodeType
- the node type with which this node type will be compared.- Returns:
true
if this node type is identical to or a subtype ofnodeType
;false
otherwise.
-
isAnyOf
Returnstrue
if this node type is identical to or a subtype (ie, descendant) of any of the specified node types.- Parameters:
nodeTypes
- the node types with which this node type will be compared.- Returns:
true
if this node type is identical to or a subtype of any ofnodeTypes
;false
otherwise.
-
isAnyOf
Returnstrue
if this node type is identical to or a subtype (ie, descendant) of any of the specified node types.- Parameters:
nodeTypes
- the node types with which this node type will be compared.- Returns:
true
if this node type is identical to or a subtype of any ofnodeTypes
;false
otherwise.
-