Class AbstractNode<N extends AbstractNode<N>>
java.lang.Object
ch.nolix.base.document.node.AbstractNode<N>
- Type Parameters:
N- the type of aAbstractNode.
- All Implemented Interfaces:
OptionalHeaderHolder, FormattedStringRepresentable, Node<N>, BlanknessRequestable
- Direct Known Subclasses:
AbstractMutableNode, ImmutableNode
-
Field Summary
Fields inherited from interface FormattedStringRepresentable
DEFAULT_IDENTATION_LEVEL, DEFAULT_IDENTTATION_SYMBOL, DEFAULT_START_MULTILINER_WITH_IDENTATION_FLAG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancontainsChildNode(Predicate<Node<?>> selector) final booleanfinal booleancontainsChildNodeWithHeader(String header) final booleanfinal booleanfinal intfinal intgetChildNodeCount(Predicate<Node<?>> selector) final ExtendedIterable<String> static StringgetEscapeStringFor(String string) getOptionalStoredFirstChildNode(Predicate<Node<?>> selector) static StringgetOriginStringFromEscapeString(String escapeString) final booleanfinal doublefinal intfinal Stringfinal NgetStoredChildNodeAtOneBasedIndex(int index) final ExtendedIterable<N> getStoredChildNodes(Predicate<Node<?>> selector) final ExtendedIterable<N> getStoredChildNodesWithHeader(String header) final Nfinal NgetStoredFirstChildNode(Predicate<Node<?>> selector) final Nfinal Nfinal inthashCode()final booleanisBlank()final voidsaveToFile(String path) Saves the currentAbstractNodeto the file with the given file path.final voidsaveToFile(String path, WriteMode writeMode) Saves the currentAbstractNodeto the file with the given path.final booleanfinal doubletoDouble()final StringtoFormattedStringWithIndentationLevelAndIndentationSymbol(int indentationLevel, String indentationSymbol, boolean startMultiLinerWithIndentation) final inttoInt()final StringtoString()final IMutableXmlNodetoXml()Methods inherited from interface FormattedStringRepresentable
toFormattedString, toFormattedStringWithIndentationLevel, toFormattedStringWithIndentationLevelAndIndentationSymbolMethods inherited from interface Node
getStoredChildNodes, withNewHeaderMethods inherited from interface OptionalHeaderHolder
getHeader, getHeaderOrEmptyString, getOptionalHeader, hasHeader, hasHeader
-
Constructor Details
-
AbstractNode
public AbstractNode()
-
-
Method Details
-
getEscapeStringFor
-
getOriginStringFromEscapeString
- Parameters:
escapeString-- Returns:
- the origin
Stringfrom the given escapeString - Throws:
NullPointerException- if the given escapeString is null
-
containsChildNodes
public final boolean containsChildNodes()- Specified by:
containsChildNodesin interfaceNode<N extends AbstractNode<N>>- Returns:
- true if the current
Nodecontains childNodes, false otherwise
-
containsChildNode
- Specified by:
containsChildNodein interfaceNode<N extends AbstractNode<N>>- Parameters:
selector-- Returns:
- true if the current
Nodecontains a childNodethe given selector selects, false otherwise
-
containsChildNodeWithHeader
- Specified by:
containsChildNodeWithHeaderin interfaceNode<N extends AbstractNode<N>>- Parameters:
header-- Returns:
- true if the current
Nodecontains a childNodewith the given header, false otherwise
-
equals
-
formattedStringWillHaveMultipleLines
public final boolean formattedStringWillHaveMultipleLines()- Specified by:
formattedStringWillHaveMultipleLinesin interfaceFormattedStringRepresentable- Returns:
- true if a formatted
Stringrepresentation of the currentFormattedStringRepresentablewill have multiple lines, false otherwise
-
getChildNodeCount
public final int getChildNodeCount()- Specified by:
getChildNodeCountin interfaceNode<N extends AbstractNode<N>>- Returns:
- the number of child
Nodes of the currentNode
-
getChildNodeCount
- Specified by:
getChildNodeCountin interfaceNode<N extends AbstractNode<N>>- Parameters:
selector-- Returns:
- the number of child
Nodes the given selector selects from the currentNode
-
getChildNodesHeaders
- Specified by:
getChildNodesHeadersin interfaceNode<N extends AbstractNode<N>>- Returns:
- the headers of the child
Nodes of the currentNode
-
getOptionalStoredFirstChildNode
- Specified by:
getOptionalStoredFirstChildNodein interfaceNode<N extends AbstractNode<N>>- Parameters:
selector-- Returns:
- a new
Optionalwith the first childNodethe given selector selects from the currentNode, an emptyOptionalotherwise
-
getStoredChildNodeAtOneBasedIndex
- Specified by:
getStoredChildNodeAtOneBasedIndexin interfaceNode<N extends AbstractNode<N>>- Parameters:
index-- Returns:
- the child
Nodeat the given oneBasedIndex from the currentNode
-
getStoredChildNodesWithHeader
- Specified by:
getStoredChildNodesWithHeaderin interfaceNode<N extends AbstractNode<N>>- Parameters:
header-- Returns:
- the child
Nodes with the given header from the currentNode
-
getStoredChildNodes
- Specified by:
getStoredChildNodesin interfaceNode<N extends AbstractNode<N>>- Parameters:
selector-- Returns:
- the child
Nodes the given selector selects from the currentNode
-
getStoredFirstChildNode
- Specified by:
getStoredFirstChildNodein interfaceNode<N extends AbstractNode<N>>- Returns:
- the first child
Nodefrom the currentNode
-
getStoredSingleChildNode
- Specified by:
getStoredSingleChildNodein interfaceNode<N extends AbstractNode<N>>- Returns:
- the single child
Nodeof the currentNode
-
getStoredFirstChildNode
- Specified by:
getStoredFirstChildNodein interfaceNode<N extends AbstractNode<N>>- Parameters:
selector-- Returns:
- the first child
Nodethe given selector selects from the currentNode
-
getStoredFirstChildNodeWithHeader
- Specified by:
getStoredFirstChildNodeWithHeaderin interfaceNode<N extends AbstractNode<N>>- Parameters:
header-- Returns:
- the first child
Nodewith the given header from the currentNode
-
getSingleChildNodeAsBoolean
public final boolean getSingleChildNodeAsBoolean()- Specified by:
getSingleChildNodeAsBooleanin interfaceNode<N extends AbstractNode<N>>- Returns:
- the boolean the single child
Nodeof the currentNoderepresents
-
getSingleChildNodeAsDouble
public final double getSingleChildNodeAsDouble()- Specified by:
getSingleChildNodeAsDoublein interfaceNode<N extends AbstractNode<N>>- Returns:
- the double the single child
Nodeof the currentNoderepresents
-
getSingleChildNodeAsInt
public final int getSingleChildNodeAsInt()- Specified by:
getSingleChildNodeAsIntin interfaceNode<N extends AbstractNode<N>>- Returns:
- the int the single child
Nodeof the currentNoderepresents
-
getSingleChildNodeHeader
- Specified by:
getSingleChildNodeHeaderin interfaceNode<N extends AbstractNode<N>>- Returns:
- the header of the single child
Nodeof the currentNode
-
hashCode
-
isBlank
public final boolean isBlank()- Specified by:
isBlankin interfaceBlanknessRequestable- Returns:
- true if
BlanknessRequestableis blank, false otherwise
-
saveToFile
Saves the currentAbstractNodeto the file with the given file path.- Parameters:
path-- Throws:
RuntimeException- if the given path is nullRuntimeException- if the given path is blankRuntimeException- if there exists already a file system item with the given path.
-
saveToFile
Saves the currentAbstractNodeto the file with the given path.- Parameters:
path-writeMode-- Throws:
RuntimeException- if the given path is nullRuntimeException- if the given path is blankRuntimeException- if the given writeMode flag=WriteMode.THROW_EXCEPTION_WHEN_TARGET_EXISTS_ALREADYand there exists already a file system item with the given path.
-
toBoolean
-
toDouble
-
toFormattedStringWithIndentationLevelAndIndentationSymbol
public final String toFormattedStringWithIndentationLevelAndIndentationSymbol(int indentationLevel, String indentationSymbol, boolean startMultiLinerWithIndentation) - Specified by:
toFormattedStringWithIndentationLevelAndIndentationSymbolin interfaceFormattedStringRepresentable- Parameters:
indentationLevel-indentationSymbol-startMultiLinerWithIndentation-- Returns:
- a formatted
Stringrepresentation of the currentFormattedStringRepresentablewith the given indentationLevel and indentationSymbol
-
toInt
-
toString
-
toXml
-