Interface INode<N extends INode<N>>
- Type Parameters:
N- the type of aINode
- All Superinterfaces:
BlanknessRequestable, FormattedStringRepresentable, OptionalHeaderHolder
- All Known Subinterfaces:
IMutableNode<N>
- All Known Implementing Classes:
AbstractMutableNode, AbstractNode, FileNode, ImmutableNode, MutableNode
public interface INode<N extends INode<N>>
extends BlanknessRequestable, FormattedStringRepresentable, OptionalHeaderHolder
A
INode has the following attributes. -0 or 1 header -an arbitrary
number of child INodes
A INode that does not have a header and does not contains attributes
is blank.
A sub type of INode may be or may be not mutable.- Author:
- Silvan Wyss
-
Field Summary
Fields inherited from interface FormattedStringRepresentable
DEFAULT_IDENTATION_LEVEL, DEFAULT_IDENTTATION_SYMBOL, DEFAULT_START_MULTILINER_WITH_IDENTATION_FLAG -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancontainsChildNodeThat(Predicate<INode<?>> selector) booleancontainsChildNodeWithHeader(String header) booleanintintgetChildNodeCount(Predicate<INode<?>> selector) getOptionalStoredFirstChildNodeThat(Predicate<INode<?>> selector) booleandoubleintgetStoredChildNodeAtOneBasedIndex(int oneBasedIndex) getStoredChildNodesThat(Predicate<INode<?>> selector) getStoredChildNodesWithHeader(String header) getStoredFirstChildNodeThat(Predicate<INode<?>> selector) booleandoubletoDouble()inttoInt()IXmlNode<?> toXml()INode<?> withNewHeader(String header) Methods inherited from interface BlanknessRequestable
isBlankMethods inherited from interface FormattedStringRepresentable
formattedStringWillHaveMultipleLines, toFormattedString, toFormattedStringWithIndentationLevel, toFormattedStringWithIndentationLevelAndIndentationSymbol, toFormattedStringWithIndentationLevelAndIndentationSymbolMethods inherited from interface OptionalHeaderHolder
getHeader, getHeaderOrEmptyString, getOptionalHeader, hasHeader, hasHeader
-
Method Details
-
containsChildNodes
-
containsChildNodeThat
-
containsChildNodeWithHeader
-
containsOneChildNode
-
getChildNodeCount
-
getChildNodeCount
- Parameters:
selector-- Returns:
- the number of child
INodes the given selector selects from the currentINode - Throws:
RuntimeException- if the given selector is null
-
getChildNodesHeaders
ExtendedIterable<String> getChildNodesHeaders()- Returns:
- the headers of the child
INodes of the currentINode - Throws:
RuntimeException- if one of the childINodes of the currentINodedoes not have a header
-
getOptionalStoredFirstChildNodeThat
-
getStoredChildNodeAtOneBasedIndex
- Parameters:
oneBasedIndex-- Returns:
- the child
INodeat the given oneBasedIndex from the currentINode - Throws:
RuntimeException- if the given index is not positiveRuntimeException- if the currentINodedoes not contain a childINodeat the given oneBasedIndex
-
getStoredChildNodes
ExtendedIterable<N> getStoredChildNodes() -
getStoredChildNodesThat
-
getStoredChildNodesWithHeader
-
getStoredFirstChildNode
-
getStoredFirstChildNodeThat
-
getStoredFirstChildNodeWithHeader
-
getStoredSingleChildNode
-
getSingleChildNodeAsBoolean
boolean getSingleChildNodeAsBoolean()- Returns:
- the boolean the single child
INodeof the currentINoderepresents - Throws:
RuntimeException- if the currentINodedoes not contain childINodes or contains several childINodesRuntimeException- if the single childINodeof the currentINodedoes not represent a boolean
-
getSingleChildNodeAsDouble
double getSingleChildNodeAsDouble()- Returns:
- the double the single child
INodeof the currentINoderepresents - Throws:
RuntimeException- if the currentINodedoes not contain childINodes or contains several childINodesRuntimeException- if the single childINodeof the currentINodedoes not represent a double
-
getSingleChildNodeAsInt
int getSingleChildNodeAsInt()- Returns:
- the int the single child
INodeof the currentINoderepresents - Throws:
RuntimeException- if the currentINodedoes not contain childINodes or contains several childINodesRuntimeException- if the single childINodeof the currentINodedoes not represent an int
-
getSingleChildNodeHeader
String getSingleChildNodeHeader()- Returns:
- the header of the single child
INodeof the currentINode - Throws:
RuntimeException- if the currentINodedoes not contain childINodes or contains several childINodesRuntimeException- if the single childINodeof the currentINodedoes not have a header
-
toBoolean
boolean toBoolean()- Returns:
- the boolean the current
INoderepresents - Throws:
RuntimeException- if the currentINodedoes not represent a boolean
-
toDouble
double toDouble()- Returns:
- the double the current
INoderepresents - Throws:
RuntimeException- if the currentINodedoes not represent a double
-
toInt
int toInt()- Returns:
- the int the current
INoderepresents - Throws:
RuntimeException- if the currentINodedoes not represent an int
-
toXml
-
withNewHeader
- Parameters:
header-- Returns:
- a new
INodefrom the currentINodewith the given new header - Throws:
RuntimeException- if the given header is null or blank
-