P - type of parent branch nodeT - type of branch nodepublic class BranchNode<P extends BranchNodeMetaModel,T extends BranchNodeMetaModel> extends Node<P,T>
| Modifier and Type | Class and Description |
|---|---|
protected class |
BranchNode.ModifyListenerContainer |
protected static class |
BranchNode.NodeContainer |
| Modifier and Type | Field and Description |
|---|---|
protected BranchNode<?,P> |
parentNode |
protected TypedTreeMetaModel.RootBranchNode<?,?> |
rootNode |
disposed, rootLinked| Modifier | Constructor and Description |
|---|---|
protected |
BranchNode(TypedTreeMetaModel.RootBranchNode<?,?> rootNode,
BranchNode<?,P> parentNode,
BranchNode.NodeContainer referencedNodeContainer)
Constructor to create new branch node.
|
| Modifier and Type | Method and Description |
|---|---|
BranchNode<P,T> |
addChildNodeListener(IChildNodeListener<T> listener,
INodeType<T,?>... childNodeTypeMask)
Add listener to get notified if child leaf nodes are updated , and child branch nodes are removed or created.
|
<X> BranchNode<P,T> |
addChildNodeListener(LeafNodeType<T,X> nodeType,
IChildNodeListener.ILeafNodeListener<T,X> listener) |
<X extends BranchNodeMetaModel> |
applyToConsumer(BranchNodeType<T,X> nodeType,
BiConsumer<BranchNode<P,T>,BranchNode<?,X>> consumer)
Applies a child node of requested
BranchNodeType to consumer. |
<X extends BranchNodeMetaModel> |
applyToConsumer(BranchNodeType<T,X> nodeType,
BiConsumer<BranchNode<P,T>,BranchNode<T,X>> ifAbsent,
BiConsumer<BranchNode<P,T>,BranchNode<T,X>> ifPresent)
Applies a child node of requested
BranchNodeType to consumer. |
BranchNode<P,T> |
applyToConsumer(Consumer<BranchNode<P,T>> consumer)
Applies this branch node to a consumer.
|
<X> BranchNode<P,T> |
applyToConsumer(LeafNodeType<? super T,X> nodeType,
BiConsumer<BranchNode<P,? super T>,LeafNode<? super T,X>> consumer)
Applies a child node of requested
LeafNodeType to consumer. |
BranchNode<P,T> |
applyToConsumerWithReadLock(Consumer<BranchNode<P,T>> consumer)
Applies this branch node to a consumer locked by tree's read lock.
|
BranchNode<P,T> |
applyToConsumerWithWriteLock(Consumer<BranchNode<P,T>> consumer)
Applies this branch node to a consumer locked by tree's write lock.
|
<X extends BranchNodeMetaModel> |
clear(BranchNodeListType<T,X> nodeType)
Remove all child nodes of requested
BranchNodeListType. |
BranchNode<P,T> |
copyFrom(BranchNode<? extends BranchNodeMetaModel,? extends T> copyFrom) |
<X extends BranchNodeMetaModel> |
create(BranchNodeListType<T,X> nodeType)
Creates new a child node of requested
BranchNodeListType. |
<X extends BranchNodeMetaModel> |
create(BranchNodeListType<T,X> nodeType,
BiConsumer<BranchNode<P,T>,BranchNode<T,X>> consumer)
Creates new a child node of requested
BranchNodeListType. |
<X extends BranchNodeMetaModel> |
create(BranchNodeType<T,X> nodeType)
Creates a new child node of requested
BranchNodeType. |
<X extends BranchNodeMetaModel> |
create(BranchNodeType<T,X> nodeType,
BiConsumer<BranchNode<P,T>,BranchNode<T,X>> consumer)
Creates a new child node of requested
BranchNodeType. |
<X extends BranchNodeMetaModel> |
createIfAbsent(BranchNodeListType<T,X> nodeType,
Predicate<BranchNode<T,X>> predicate,
BiConsumer<BranchNode<P,T>,BranchNode<T,X>> consumer)
Creates a new child node of requested
BranchNodeListType, if no item exists matched by predicate. |
protected void |
disposeNode()
Dispose this node and all child nodes.
|
<X extends BranchNodeMetaModel> |
get(BranchNodeListType<T,X> nodeType,
Predicate<BranchNode<T,X>> predicate)
Get first matched child node of requested
BranchNodeListType. |
<X extends BranchNodeMetaModel> |
get(BranchNodeType<T,X> nodeType)
Getter for a child node of requested
BranchNodeType. |
<X> LeafNode<T,X> |
get(LeafNodeType<? super T,X> nodeType)
Getter for a child node of requested
LeafNodeType. |
List<BranchNodeListType> |
getBranchNodeListTypeList()
returns all branch node list types of model
|
List<BranchNodeType> |
getBranchNodeTypeList()
returns all branch node types of model
|
List<LeafNodeType> |
getLeafNodeTypeList()
returns all leaf node types of model
|
INodeType<P,T> |
getNodeType() |
BranchNode<?,P> |
getParentNode()
Getter for parent node.
|
TypedTreeMetaModel.RootBranchNode<?,?> |
getRootNode()
Getter for root node.
|
<X extends BranchNodeMetaModel> |
getUnmodifiableNodeList(BranchNodeListType<T,X> nodeType)
Getter for unmodifiable child node list with all child nodes of requested
BranchNodeListType. |
<X extends BranchNodeMetaModel> |
getUnmodifiableNodeListSnapshot(BranchNodeListType<T,X> nodeType)
Getter for a snapshot of unmodifiable child node list with all child nodes of requested
BranchNodeListType. |
<X extends BranchNodeMetaModel> |
getUnmodifiableNodeListSnapshot(BranchNodeListType<T,X> nodeType,
Predicate<BranchNode<T,X>> predicate)
Getter for a snapshot of unmodifiable child node list with filtered child nodes of requested
BranchNodeListType. |
<X> X |
getValue(LeafNodeType<? super T,X> nodeType)
Gets a value of the child node of requested
LeafNodeType |
<X> void |
registerForModify(ModelPath<T,X> path,
IModifyListener<X> listener) |
<X extends BranchNodeMetaModel> |
remove(BranchNodeListType<T,X> nodeType,
BranchNode<P,T> node)
Remove child node of requested
BranchNodeListType. |
<X extends BranchNodeMetaModel> |
remove(BranchNodeListType<T,X> nodeType,
int index)
Remove child node of requested
BranchNodeListType. |
<X extends BranchNodeMetaModel> |
remove(BranchNodeType<T,X> nodeType)
Removes a child node of requested
BranchNodeType. |
BranchNode<P,T> |
removeChildNodeListener(IChildNodeListener<T> listener)
Removes child node listener
|
<X extends BranchNodeMetaModel> |
setComperator(BranchNodeListType<T,X> nodeType,
Comparator<BranchNode<T,X>> comparator)
Sets a comparator to sort all child nodes for requested
BranchNodeListType. |
protected void |
setRootLinked(boolean rootLinked) |
<X> BranchNode<P,T> |
setValue(LeafNodeType<? super T,X> nodeType,
X value)
Sets a value for the child node of requested
LeafNodeType |
<X> void |
unregisterForModify(ModelPath<T,X> path) |
isDisposed, isRootLinkedprotected TypedTreeMetaModel.RootBranchNode<?,?> rootNode
protected BranchNode<?,P extends BranchNodeMetaModel> parentNode
protected BranchNode(TypedTreeMetaModel.RootBranchNode<?,?> rootNode, BranchNode<?,P> parentNode, BranchNode.NodeContainer referencedNodeContainer)
rootNode - root node instanceparentNode - parent node instancereferencedNodeContainer - static type instance defined in modelprotected void disposeNode()
disposeNode in class Node<P extends BranchNodeMetaModel,T extends BranchNodeMetaModel>public INodeType<P,T> getNodeType()
getNodeType in class Node<P extends BranchNodeMetaModel,T extends BranchNodeMetaModel>protected void setRootLinked(boolean rootLinked)
setRootLinked in class Node<P extends BranchNodeMetaModel,T extends BranchNodeMetaModel>public TypedTreeMetaModel.RootBranchNode<?,?> getRootNode()
public BranchNode<?,P> getParentNode()
public List<LeafNodeType> getLeafNodeTypeList()
public List<BranchNodeType> getBranchNodeTypeList()
public List<BranchNodeListType> getBranchNodeListTypeList()
public BranchNode<P,T> applyToConsumer(Consumer<BranchNode<P,T>> consumer)
consumer - consumer to consume this branch nodepublic BranchNode<P,T> applyToConsumerWithReadLock(Consumer<BranchNode<P,T>> consumer)
consumer - consumer to consume this branch nodepublic BranchNode<P,T> applyToConsumerWithWriteLock(Consumer<BranchNode<P,T>> consumer)
consumer - consumer to consume this branch nodepublic <X> LeafNode<T,X> get(LeafNodeType<? super T,X> nodeType)
LeafNodeType.nodeType - static child node type instance from meta modelpublic <X> BranchNode<P,T> applyToConsumer(LeafNodeType<? super T,X> nodeType, BiConsumer<BranchNode<P,? super T>,LeafNode<? super T,X>> consumer)
LeafNodeType to consumer.nodeType - static child node type instance from meta modelconsumer - consumer to consume child nodepublic <X> BranchNode<P,T> setValue(LeafNodeType<? super T,X> nodeType, X value)
LeafNodeTypenodeType - static child node type instance from meta modelvalue - value for child nodepublic <X> X getValue(LeafNodeType<? super T,X> nodeType)
LeafNodeTypenodeType - static child node type instance from meta modelpublic <X extends BranchNodeMetaModel> BranchNode<P,T> applyToConsumer(BranchNodeType<T,X> nodeType, BiConsumer<BranchNode<P,T>,BranchNode<?,X>> consumer)
BranchNodeType to consumer.nodeType - static child node type instance from meta modelconsumer - consumerpublic <X extends BranchNodeMetaModel> BranchNode<P,T> applyToConsumer(BranchNodeType<T,X> nodeType, BiConsumer<BranchNode<P,T>,BranchNode<T,X>> ifAbsent, BiConsumer<BranchNode<P,T>,BranchNode<T,X>> ifPresent)
BranchNodeType to consumer.nodeType - static child node type instance from meta modelifAbsent - consumer to use if the child node does not already existifPresent - consumer to use if the child node already existspublic <X extends BranchNodeMetaModel> BranchNode<P,T> remove(BranchNodeType<T,X> nodeType)
BranchNodeType.nodeType - static child node type instance from meta modelpublic <X extends BranchNodeMetaModel> BranchNode<T,X> create(BranchNodeType<T,X> nodeType)
BranchNodeType.nodeType - static child node type instance from meta modelpublic <X extends BranchNodeMetaModel> BranchNode<T,X> create(BranchNodeType<T,X> nodeType, BiConsumer<BranchNode<P,T>,BranchNode<T,X>> consumer)
BranchNodeType.nodeType - static child node type instance from meta modelconsumer - builder to set up the childpublic <X extends BranchNodeMetaModel> BranchNode<T,X> get(BranchNodeType<T,X> nodeType)
BranchNodeType. If the child node does not exist and TypedTreeMetaModel.RootBranchNode.setBranchNodeGetterAutoCreate(boolean) was invoked with parameter true,
the child node will be created automatically.nodeType - static child node type instance from meta modelpublic <X extends BranchNodeMetaModel> List<BranchNode<T,X>> getUnmodifiableNodeList(BranchNodeListType<T,X> nodeType)
BranchNodeListType.nodeType - static child node type instance from meta modelpublic <X extends BranchNodeMetaModel> List<BranchNode<T,X>> getUnmodifiableNodeListSnapshot(BranchNodeListType<T,X> nodeType)
BranchNodeListType.nodeType - static child node type instance from meta modelpublic <X extends BranchNodeMetaModel> List<BranchNode<T,X>> getUnmodifiableNodeListSnapshot(BranchNodeListType<T,X> nodeType, Predicate<BranchNode<T,X>> predicate)
BranchNodeListType.nodeType - static child node type instance from meta modelpredicate - filter for snapshotpublic <X extends BranchNodeMetaModel> BranchNode<P,T> setComperator(BranchNodeListType<T,X> nodeType, Comparator<BranchNode<T,X>> comparator)
BranchNodeListType.nodeType - static child node type instance from meta model.comparator - comparator to applypublic <X extends BranchNodeMetaModel> BranchNode<T,X> get(BranchNodeListType<T,X> nodeType, Predicate<BranchNode<T,X>> predicate)
BranchNodeListType.nodeType - static child node type instance from meta modelpredicate - filterpublic <X extends BranchNodeMetaModel> BranchNode<T,X> create(BranchNodeListType<T,X> nodeType)
BranchNodeListType.nodeType - type static child node type instance from meta model.public <X extends BranchNodeMetaModel> BranchNode<P,T> create(BranchNodeListType<T,X> nodeType, BiConsumer<BranchNode<P,T>,BranchNode<T,X>> consumer)
BranchNodeListType.nodeType - static child node type instance from meta model.consumer - setup new child nodepublic <X extends BranchNodeMetaModel> BranchNode<P,T> createIfAbsent(BranchNodeListType<T,X> nodeType, Predicate<BranchNode<T,X>> predicate, BiConsumer<BranchNode<P,T>,BranchNode<T,X>> consumer)
BranchNodeListType, if no item exists matched by predicate.nodeType - static child node type instance from meta model.predicate - predicate to test existing itemsconsumer - setup new child nodepublic <X extends BranchNodeMetaModel> boolean remove(BranchNodeListType<T,X> nodeType, BranchNode<P,T> node)
BranchNodeListType.nodeType - static child node type instance from meta modelnode - node instance to removepublic <X extends BranchNodeMetaModel> BranchNode<P,T> clear(BranchNodeListType<T,X> nodeType)
BranchNodeListType.nodeType - static child node type instance from meta model
return this branch nodepublic <X extends BranchNodeMetaModel> boolean remove(BranchNodeListType<T,X> nodeType, int index)
BranchNodeListType.nodeType - static child node type instance from meta modelindex - position index of child node in listpublic BranchNode<P,T> removeChildNodeListener(IChildNodeListener<T> listener)
listener - listener to removepublic <X> BranchNode<P,T> addChildNodeListener(LeafNodeType<T,X> nodeType, IChildNodeListener.ILeafNodeListener<T,X> listener)
public BranchNode<P,T> addChildNodeListener(IChildNodeListener<T> listener, INodeType<T,?>... childNodeTypeMask)
listener - listener to registerchildNodeTypeMask - affected child node typespublic <X> void registerForModify(ModelPath<T,X> path, IModifyListener<X> listener)
public BranchNode<P,T> copyFrom(BranchNode<? extends BranchNodeMetaModel,? extends T> copyFrom)
Copyright © 2020. All rights reserved.