Class MutableNode
java.lang.Object
ch.nolix.base.document.node.AbstractNode<MutableNode>
ch.nolix.base.document.node.AbstractMutableNode<MutableNode>
ch.nolix.base.document.node.MutableNode
- All Implemented Interfaces:
FluentMutableOptionalHeaderHolder<MutableNode>, OptionalHeaderHolder, FormattedStringRepresentable, IMutableNode<MutableNode>, Node<MutableNode>, Resettable, BlanknessRequestable
- 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 TypeMethodDescriptionaddChildNode(Node<?> childNode) Adds the given childNode to the currentIMutableNode.addChildNodes(Node<?>... childNodes) Adds the given childNodes to the currentIMutableNode.<N extends Node<?>>
MutableNodeaddChildNodes(Iterable<N> pChildNodes) Adds the given childNodes to the currentIMutableNode.addChildNodesFromStrings(Iterable<String> strings) Adds the childNodes from the given strings the currentIMutableNode.addChildNodesFromStrings(String... strings) Adds the childNodes from the given strings to the currentIMutableNode.static MutableNodestatic MutableNodestatic MutableNodestatic MutableNodefromString(String string) booleanremoveAndGetStoredFirstChildNodeThat(Predicate<Node<?>> selector) Removes and returns the first childNodethe given selector selects from the currentIMutableNode.voidRemoves the childNodes from the currentIMutableNode.voidremoveFirstChildNodeThat(Predicate<Node<?>> selector) Removes the first childNodethe given selector selects from the currentIMutableNode.voidremoveFirstChildNodeWithHeader(String header) Removes the first childNodewith the given header from the currentIMutableNode.voidRemoves the header of currentFluentMutableOptionalHeaderHolder.voidreplaceFirstChildNodeWithGivenHeaderByGivenNode(String header, Node<?> childNode) Replaces the first childNodewith the given header from the currentIMutableNodeby the givenNode.voidreset()Resets the currentResettable.Sets the header of the currentFluentMutableOptionalHeaderHolder.Node<?> withNewHeader(String header) Methods inherited from class AbstractMutableNode
addPostfixToHeader, addPrefixToHeader, resetFromFile, resetFromNode, resetFromString, setChildNodesMethods inherited from class AbstractNode
containsChildNode, containsChildNodes, containsChildNodeWithHeader, equals, formattedStringWillHaveMultipleLines, getChildNodeCount, getChildNodeCount, getChildNodesHeaders, getEscapeStringFor, getOptionalStoredFirstChildNode, getOriginStringFromEscapeString, getSingleChildNodeAsBoolean, getSingleChildNodeAsDouble, getSingleChildNodeAsInt, getSingleChildNodeHeader, getStoredChildNodeAtOneBasedIndex, getStoredChildNodes, getStoredChildNodesWithHeader, getStoredFirstChildNode, getStoredFirstChildNode, getStoredFirstChildNodeWithHeader, getStoredSingleChildNode, hashCode, isBlank, saveToFile, saveToFile, toBoolean, toDouble, toFormattedStringWithIndentationLevelAndIndentationSymbol, toInt, toString, toXmlMethods inherited from interface BlanknessRequestable
isBlankMethods inherited from interface FormattedStringRepresentable
formattedStringWillHaveMultipleLines, toFormattedString, toFormattedStringWithIndentationLevel, toFormattedStringWithIndentationLevelAndIndentationSymbol, toFormattedStringWithIndentationLevelAndIndentationSymbolMethods inherited from interface Node
containsChildNode, containsChildNodes, containsChildNodeWithHeader, getChildNodeCount, getChildNodeCount, getChildNodesHeaders, getOptionalStoredFirstChildNode, getSingleChildNodeAsBoolean, getSingleChildNodeAsDouble, getSingleChildNodeAsInt, getSingleChildNodeHeader, getStoredChildNodeAtOneBasedIndex, getStoredChildNodes, getStoredChildNodesWithHeader, getStoredFirstChildNode, getStoredFirstChildNode, getStoredFirstChildNodeWithHeader, getStoredSingleChildNode, toBoolean, toDouble, toInt, toXmlMethods inherited from interface OptionalHeaderHolder
getHeaderOrEmptyString, getOptionalHeader, hasHeader
-
Method Details
-
createEmpty
- Returns:
- a new empty
MutableNode.
-
fromFile
- Parameters:
filePath-- Returns:
- a new
MutableNodefrom the file with the given filePath - Throws:
RuntimeException- if the given filePath is not validRuntimeException- if the file with the given filePath does not represent aMutableNode.
-
fromNode
- Parameters:
node-- Returns:
- a new
MutableNodefrom the givenNode.
-
fromString
- Parameters:
string-- Returns:
- a new
MutableNodefrom the given string - Throws:
RuntimeException- if the given string does not represent aMutableNode.
-
addChildNode
Adds the given childNode to the currentIMutableNode.- Parameters:
childNode-- Returns:
- the current
IMutableNode
-
addChildNodes
Adds the given childNodes to the currentIMutableNode.- Parameters:
childNodes-- Returns:
- the current
IMutableNode
-
addChildNodes
Adds the given childNodes to the currentIMutableNode.- Type Parameters:
N- the type of the given childNodes- Parameters:
pChildNodes-- Returns:
- the current
IMutableNode
-
addChildNodesFromStrings
Adds the childNodes from the given strings the currentIMutableNode.- Parameters:
strings-- Returns:
- the current
IMutableNode
-
addChildNodesFromStrings
Adds the childNodes from the given strings to the currentIMutableNode.- Parameters:
strings-- Returns:
- the current
IMutableNode
-
withNewHeader
-
getStoredChildNodes
-
getHeader
- Returns:
- the header of the current
OptionalHeaderHolder
-
hasHeader
public boolean hasHeader()- Returns:
- true if the current
OptionalHeaderHolderhas a header, false otherwise
-
removeChildNodes
public void removeChildNodes()Removes the childNodes from the currentIMutableNode. -
removeAndGetStoredFirstChildNodeThat
Removes and returns the first childNodethe given selector selects from the currentIMutableNode.- Parameters:
selector-- Returns:
- the first child
Nodethe given selector selects from the currentIMutableNode
-
removeFirstChildNodeThat
Removes the first childNodethe given selector selects from the currentIMutableNode.- Parameters:
selector-
-
removeFirstChildNodeWithHeader
Removes the first childNodewith the given header from the currentIMutableNode.- Parameters:
header-
-
removeHeader
public void removeHeader()Removes the header of currentFluentMutableOptionalHeaderHolder. -
replaceFirstChildNodeWithGivenHeaderByGivenNode
Replaces the first childNodewith the given header from the currentIMutableNodeby the givenNode.- Parameters:
header-childNode-
-
reset
public void reset()Resets the currentResettable. -
setHeader
Sets the header of the currentFluentMutableOptionalHeaderHolder.- Parameters:
header-- Returns:
- the current
FluentMutableOptionalHeaderHolder
-