public abstract class AbstractMicroNode extends Object implements IMicroNode
| Constructor and Description |
|---|
AbstractMicroNode() |
| Modifier and Type | Method and Description |
|---|---|
<NODETYPE extends IMicroNode> |
appendChild(NODETYPE aChildNode)
Append any child to the node.
|
IMicroNode |
detachFromParent()
Detach this node from the parent node so it can be inserted into another
node without problems.
|
IMicroNode |
findFirstChild(Predicate<? super IMicroNode> aFilter) |
<DSTTYPE> DSTTYPE |
findFirstChildMapped(Predicate<? super IMicroNode> aFilter,
Function<? super IMicroNode,? extends DSTTYPE> aMapper) |
IMicroElement |
findParentElement(Predicate<? super IMicroElement> aFilter) |
void |
forAllChildren(Consumer<? super IMicroNode> aConsumer) |
void |
forAllChildren(Predicate<? super IMicroNode> aFilter,
Consumer<? super IMicroNode> aConsumer) |
com.helger.commons.state.EContinue |
forAllChildrenBreakable(Function<? super IMicroNode,com.helger.commons.state.EContinue> aConsumer) |
<DSTTYPE> void |
forAllChildrenMapped(Predicate<? super IMicroNode> aFilter,
Function<? super IMicroNode,? extends DSTTYPE> aMapper,
Consumer<? super DSTTYPE> aConsumer) |
com.helger.commons.collection.impl.ICommonsList<IMicroNode> |
getAllChildren()
Get a list of all direct child nodes.
|
com.helger.commons.collection.impl.ICommonsMap<EMicroEvent,com.helger.commons.callback.CallbackList<IMicroEventTarget>> |
getAllEventTargets() |
com.helger.commons.callback.CallbackList<IMicroEventTarget> |
getAllEventTargets(EMicroEvent eEvent)
Get all event targets for a certain event.
|
IMicroNode |
getChildAtIndex(int nIndex) |
int |
getChildCount() |
com.helger.commons.collection.impl.ICommonsIterable<IMicroNode> |
getChildren() |
IMicroNode |
getFirstChild() |
IMicroNode |
getLastChild() |
IMicroNode |
getNextSibling() |
IMicroNode |
getParent() |
IMicroNode |
getPreviousSibling() |
boolean |
hasChildren() |
boolean |
hasParent() |
<NODETYPE extends IMicroNode> |
insertAfter(NODETYPE aChildNode,
IMicroNode aPredecessor)
Insert an existing node after a certain child node of this.
|
<NODETYPE extends IMicroNode> |
insertAtIndex(int nIndex,
NODETYPE aChildNode)
Insert an existing node as a child at the specified index.
|
<NODETYPE extends IMicroNode> |
insertBefore(NODETYPE aChildNode,
IMicroNode aSuccessor)
Insert an existing node before a certain child node of this.
|
protected void |
internalResetParentNode() |
protected void |
internalSetParentNode(AbstractMicroNodeWithChildren aParentNode) |
protected void |
internalTriggerEvent(EMicroEvent eEventType,
IMicroEvent aEvent) |
boolean |
isCDATA() |
boolean |
isComment() |
boolean |
isContainer() |
boolean |
isDocument() |
boolean |
isDocumentType() |
boolean |
isElement() |
boolean |
isEntityReference() |
boolean |
isProcessingInstruction() |
boolean |
isText() |
protected void |
onAppendChild(AbstractMicroNode aChildNode)
Callback that is invoked once a child is to be appended.
|
protected void |
onEvent(EMicroEvent eEventType,
IMicroNode aSourceNode,
IMicroNode aTargetNode) |
protected void |
onInsertAfter(AbstractMicroNode aChildNode,
IMicroNode aPredecessor)
Callback that is invoked once a child is to be inserted after another
child.
|
protected void |
onInsertAtIndex(int nIndex,
AbstractMicroNode aChildNode)
Callback that is invoked once a child is to be inserted at the specified
index.
|
protected void |
onInsertBefore(AbstractMicroNode aChildNode,
IMicroNode aSuccessor)
Callback that is invoked once a child is to be inserted before another
child.
|
protected com.helger.commons.state.EChange |
onRemoveAllChildren()
Remove all children from this node.
|
protected com.helger.commons.state.EChange |
onRemoveChild(IMicroNode aChild)
Callback when a child is removed.
|
protected com.helger.commons.state.EChange |
onRemoveChildAtIndex(int nIndex)
Remove the child not at the specified index.
|
com.helger.commons.state.EChange |
registerEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Register a specific MicroDOM event listener.
|
com.helger.commons.state.EChange |
removeAllChildren()
Remove all children from this node.
|
com.helger.commons.state.EChange |
removeChild(IMicroNode aChild)
Remove the passed child.
|
com.helger.commons.state.EChange |
removeChildAtIndex(int nIndex)
Remove the child not at the specified index.
|
String |
toString() |
com.helger.commons.state.EChange |
unregisterEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Unregister a specific MicroDOM event listener.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitappendCDATA, appendCDATA, appendCDATA, appendCDATAWithConversion, appendComment, appendComment, appendComment, appendCommentWithConversion, appendContainer, appendElement, appendElement, appendEntityReference, appendIgnorableWhitespaceText, appendIgnorableWhitespaceText, appendIgnorableWhitespaceText, appendProcessingInstruction, appendText, appendText, appendText, appendTextWithConversion, containsAnyChild, getAllChildrenRecursive, getNodeName, getNodeValue, getParentElementWithName, getParentElementWithName, getType, isEqualContent, replaceChild@OverrideOnDemand protected void onAppendChild(@Nonnull AbstractMicroNode aChildNode)
aChildNode - The appended child node.@OverrideOnDemand protected void onInsertBefore(@Nonnull AbstractMicroNode aChildNode, @Nonnull IMicroNode aSuccessor)
aChildNode - The new child node to be inserted.aSuccessor - The node before which the new node will be inserted.@OverrideOnDemand protected void onInsertAfter(@Nonnull AbstractMicroNode aChildNode, @Nonnull IMicroNode aPredecessor)
aChildNode - The new child node to be inserted.aPredecessor - The node after which the new node will be inserted.@OverrideOnDemand protected void onInsertAtIndex(@Nonnegative int nIndex, @Nonnull AbstractMicroNode aChildNode)
nIndex - The index where the node should be inserted.aChildNode - The new child node to be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE appendChild(@Nullable NODETYPE aChildNode)
IMicroNodeappendChild in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The child node to append. May be null.null if the parameter was
null.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertBefore(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aSuccessor)
IMicroNodeinsertBefore in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aSuccessor - The node before which the new node will be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertAfter(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aPredecessor)
IMicroNodeinsertAfter in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aPredecessor - The node after which the new node will be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertAtIndex(@Nonnegative int nIndex, @Nullable NODETYPE aChildNode)
IMicroNodeinsertAtIndex in interface IMicroNodeNODETYPE - Parameter type == return typenIndex - The index to insert. Must be ≥ 0.aChildNode - The new child node to be inserted.@OverrideOnDemand @Nonnull protected com.helger.commons.state.EChange onRemoveChild(IMicroNode aChild)
aChild - The child that is removed.EChange.CHANGED if something changed@Nonnull public final com.helger.commons.state.EChange removeChild(@Nonnull IMicroNode aChild)
IMicroNoderemoveChild in interface IMicroNodeaChild - The child to be removed. May not be null.EChange.CHANGED if the child was successfully removed,
EChange.UNCHANGED otherwise.@OverrideOnDemand @Nonnull protected com.helger.commons.state.EChange onRemoveChildAtIndex(int nIndex)
nIndex - The 0-based index of the item to be removed.EChange.CHANGED if the node was successfully removed,
EChange.UNCHANGED otherwise.@Nonnull public final com.helger.commons.state.EChange removeChildAtIndex(@Nonnegative int nIndex)
IMicroNoderemoveChildAtIndex in interface IMicroNodenIndex - The 0-based index of the item to be removed.EChange.CHANGED if the node was successfully removed,
EChange.UNCHANGED otherwise.@OverrideOnDemand @Nonnull protected com.helger.commons.state.EChange onRemoveAllChildren()
EChange.CHANGED if at least one child was present, and was
successfully removed, EChange.UNCHANGED otherwise.@Nonnull public final com.helger.commons.state.EChange removeAllChildren()
IMicroNoderemoveAllChildren in interface IMicroNodeEChange.CHANGED if at least one child was present, and was
successfully removed, EChange.UNCHANGED otherwise.@OverrideOnDemand public boolean hasChildren()
hasChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@OverrideOnDemand @Nullable public com.helger.commons.collection.impl.ICommonsList<IMicroNode> getAllChildren()
IMicroNodegetAllChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>getAllChildren in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>getAllChildren in interface IMicroNodenull if the node has no children.@OverrideOnDemand @Nullable public com.helger.commons.collection.impl.ICommonsIterable<IMicroNode> getChildren()
getChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>public void forAllChildren(@Nonnull Consumer<? super IMicroNode> aConsumer)
forAllChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@Nonnull public com.helger.commons.state.EContinue forAllChildrenBreakable(@Nonnull Function<? super IMicroNode,com.helger.commons.state.EContinue> aConsumer)
forAllChildrenBreakable in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>public void forAllChildren(@Nonnull Predicate<? super IMicroNode> aFilter, @Nonnull Consumer<? super IMicroNode> aConsumer)
forAllChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>public <DSTTYPE> void forAllChildrenMapped(@Nonnull Predicate<? super IMicroNode> aFilter, @Nonnull Function<? super IMicroNode,? extends DSTTYPE> aMapper, @Nonnull Consumer<? super DSTTYPE> aConsumer)
forAllChildrenMapped in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@OverrideOnDemand @Nullable public IMicroNode getChildAtIndex(@Nonnegative int nIndex)
getChildAtIndex in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>@OverrideOnDemand @Nonnegative public int getChildCount()
getChildCount in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@OverrideOnDemand @Nullable public IMicroNode getFirstChild()
getFirstChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>getFirstChild in interface IMicroNodenull if this
node has no children.@Nullable public IMicroNode findFirstChild(@Nonnull Predicate<? super IMicroNode> aFilter)
findFirstChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>@Nullable public <DSTTYPE> DSTTYPE findFirstChildMapped(@Nonnull Predicate<? super IMicroNode> aFilter, @Nonnull Function<? super IMicroNode,? extends DSTTYPE> aMapper)
findFirstChildMapped in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>@OverrideOnDemand @Nullable public IMicroNode getLastChild()
getLastChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>getLastChild in interface IMicroNodenull if this node
has no children.@Nullable public final IMicroNode getPreviousSibling()
getPreviousSibling in interface IMicroNodenull if this node has no preceding siblings.@Nullable public final IMicroNode getNextSibling()
getNextSibling in interface IMicroNodenull
if this node has no succeeding siblings.public final boolean hasParent()
hasParent in interface com.helger.commons.hierarchy.IHasParent<IMicroNode>hasParent in interface IMicroNodetrue if this node has a parent node assigned,
false otherwise.@Nullable public final IMicroNode getParent()
getParent in interface com.helger.commons.hierarchy.IHasParent<IMicroNode>getParent in interface IMicroNodenull.protected final void internalResetParentNode()
protected final void internalSetParentNode(@Nonnull AbstractMicroNodeWithChildren aParentNode)
@Nonnull public final IMicroNode detachFromParent()
IMicroNodeIllegalStateException if adding this node again to another parent
since each node can only have one parent.detachFromParent in interface IMicroNode@Nullable public IMicroElement findParentElement(@Nonnull Predicate<? super IMicroElement> aFilter)
findParentElement in interface IMicroNodepublic final boolean isDocument()
isDocument in interface IMicroNodetrue if this node can safely be casted to
IMicroDocument.public final boolean isDocumentType()
isDocumentType in interface IMicroNodetrue if this node can safely be casted to
IMicroDocumentType.public final boolean isText()
isText in interface IMicroNodetrue if this node can safely be casted to
IMicroText.public final boolean isCDATA()
isCDATA in interface IMicroNodetrue if this node can safely be casted to
IMicroCDATA.public final boolean isComment()
isComment in interface IMicroNodetrue if this node can safely be casted to
IMicroComment.public final boolean isEntityReference()
isEntityReference in interface IMicroNodetrue if this node can safely be casted to
IMicroEntityReference.public final boolean isElement()
isElement in interface IMicroNodetrue if this node can safely be casted to
IMicroElement.public final boolean isProcessingInstruction()
isProcessingInstruction in interface IMicroNodetrue if this node can safely be casted to
IMicroProcessingInstruction.public final boolean isContainer()
isContainer in interface IMicroNodetrue if this node can safely be casted to
IMicroContainer.protected final void internalTriggerEvent(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEvent aEvent)
protected final void onEvent(@Nonnull EMicroEvent eEventType, @Nonnull IMicroNode aSourceNode, @Nonnull IMicroNode aTargetNode)
@Nonnull public com.helger.commons.state.EChange registerEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
IMicroNoderegisterEventTarget in interface IMicroNodeeEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was registered,
EChange.UNCHANGED otherwise.@Nonnull public com.helger.commons.state.EChange unregisterEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
IMicroNodeunregisterEventTarget in interface IMicroNodeeEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was unregistered,
EChange.UNCHANGED otherwise.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsMap<EMicroEvent,com.helger.commons.callback.CallbackList<IMicroEventTarget>> getAllEventTargets()
getAllEventTargets in interface IMicroNodenull.@Nonnull @ReturnsMutableCopy public com.helger.commons.callback.CallbackList<IMicroEventTarget> getAllEventTargets(@Nullable EMicroEvent eEvent)
IMicroNodegetAllEventTargets in interface IMicroNodeeEvent - The event to be queried. May be null.null.Copyright © 2014–2018 Philip Helger. All rights reserved.