Interface IChainedNode
- All Superinterfaces:
BlanknessRequestable, IOptionalHeaderHolder
- All Known Implementing Classes:
ChainedNode
A
IChainedNode has the following attributes. -0 or 1 header -an
arbitrary number of child IChainedNodes -0 or 1 next
IChainedNode
A IChainedNode that does not have a header, does not contain
attributes and does not have a next IChainedNode is blank.
A IChainedNode is not mutable.- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetChildNodeAtOneBasedIndex(int oneBasedIndex) intIContainer<? extends IChainedNode> getFirstChildNodeWithHeader(String header) doubleintbooleandoubletoDouble()inttoInt()INode<?> toNode()Methods inherited from interface BlanknessRequestable
isBlankMethods inherited from interface IOptionalHeaderHolder
getHeader, getHeaderOrEmptyString, getOptionalHeader, hasHeader, hasHeader
-
Method Details
-
containsChildNodes
boolean containsChildNodes()- Returns:
- true if the current
IChainedNodecontains child nodes, false otherwise.
-
getChildNodeAtOneBasedIndex
- Parameters:
oneBasedIndex-- Returns:
- the child node of the current
IChainedNodeat the given oneBasedIndex . - Throws:
RuntimeException- if the currentIChainedNodedoes not contain a child node at the given oneBasedIndex.
-
getChildNodeCount
int getChildNodeCount()- Returns:
- the number of child nodes of the current
IChainedNode.
-
getChildNodes
IContainer<? extends IChainedNode> getChildNodes()- Returns:
- the child nodes of the current
IChainedNode.
-
getFirstChildNodeWithHeader
- Parameters:
header-- Returns:
- the first child node with the given header from the current
IChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not contain a child node with the given header.
-
getNextNode
IChainedNode getNextNode()- Returns:
- the next node of the current
IChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not have a next node.
-
getSingleChildNode
IChainedNode getSingleChildNode()- Returns:
- the single child node of the current
IChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not contain a child node or contains multiple child nodes.
-
getSingleChildNodeHeader
String getSingleChildNodeHeader()- Returns:
- the header of the single child node of the current
IChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not contain a child node or contains multiple child nodes.RuntimeException- if the single child node of the currentIChainedNodedoes not have a header.
-
getSingleChildNodeAsDouble
double getSingleChildNodeAsDouble()- Returns:
- a double representation of the single child node of the current
IChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not contain a child nodes or contains multiple child nodes.RuntimeException- if the single child node of the currentIChainedNodedoes not have a header.RuntimeException- if the header of the single child node of the currentIChainedNodedoes not represent a double.
-
getSingleChildNodeAsInt
int getSingleChildNodeAsInt()- Returns:
- a int representation of the single child node of the current
IChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not contain a child node or contains multiple child nodes.RuntimeException- if the single child node of the currentIChainedNodedoes not have a header.RuntimeException- if the header of the single child node of the currentIChainedNodedoes not represent an int.
-
getSingleChildNodeAsString
String getSingleChildNodeAsString()- Returns:
- a
Stringrepresentation of the single child node of the currentIChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not contain a child node or contains multiple child nodes.
-
hasNextNode
boolean hasNextNode()- Returns:
- true if the current
IChainedNodehas a next node, false otherwise.
-
toDouble
double toDouble()- Returns:
- the double the current
IChainedNoderepresents. - Throws:
RuntimeException- if the currentIChainedNodedoes not represent a double.
-
toInt
int toInt()- Returns:
- the int the current
IChainedNoderepresents. - Throws:
RuntimeException- if the currentIChainedNodedoes not represent an int.
-
toNode
INode<?> toNode()AIChainedNoderepresents aINodeif: -TheIChainedNodedoes not have a next node. -Each child nodes of theIChainedNoderepresents aINode.- Returns:
- a
INoderepresentation of the currentIChainedNode. - Throws:
RuntimeException- if the currentIChainedNodedoes not represent aINode.
-