|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.infinispan.batch.AutoBatchSupport org.infinispan.tree.TreeStructureSupport org.infinispan.tree.NodeImpl<K,V>
public class NodeImpl<K,V>
Implementation backed by an AtomicMap
Field Summary |
---|
Fields inherited from class org.infinispan.tree.TreeStructureSupport |
---|
cache, icc |
Fields inherited from class org.infinispan.batch.AutoBatchSupport |
---|
batchContainer |
Constructor Summary | |
---|---|
NodeImpl(Fqn fqn,
Cache<?,?> cache,
BatchContainer batchContainer,
InvocationContextContainer icc)
|
Method Summary | |
---|---|
Node<K,V> |
addChild(Fqn f)
Adds a child node with the given Fqn under the current node. |
Node<K,V> |
addChild(Fqn f,
Flag... flags)
|
void |
clearData()
Removes all mappings from the node's data map. |
void |
clearData(Flag... flags)
|
int |
dataSize()
|
int |
dataSize(Flag... flags)
|
boolean |
equals(Object o)
|
V |
get(K key)
Returns the value to which this node maps the specified key. |
V |
get(K key,
Flag... flags)
|
Node<K,V> |
getChild(Fqn f)
Returns the child node |
Node<K,V> |
getChild(Fqn f,
Flag... flags)
|
Node<K,V> |
getChild(Object name)
|
Node<K,V> |
getChild(Object name,
Flag... flags)
|
Set<Node<K,V>> |
getChildren()
Returns an immutable set of children nodes. |
Set<Node<K,V>> |
getChildren(Flag... flags)
|
Set<Object> |
getChildrenNames()
Returns an immutable set of children node names. |
Set<Object> |
getChildrenNames(Flag... flags)
|
Map<K,V> |
getData()
Returns a map containing the data in this Node . |
Map<K,V> |
getData(Flag... flags)
|
Fqn |
getFqn()
Returns the Fqn which represents the location of this Node in the cache structure. |
Set<K> |
getKeys()
Returns a Set containing the data in this Node . |
Set<K> |
getKeys(Flag... flags)
|
Node<K,V> |
getParent()
Returns the parent node. |
Node<K,V> |
getParent(Flag... flags)
|
boolean |
hasChild(Fqn f)
Returns true if the child node denoted by the relative Fqn passed in exists. |
boolean |
hasChild(Fqn f,
Flag... flags)
|
boolean |
hasChild(Object o)
Returns true if the child node denoted by the Object name passed in exists. |
boolean |
hasChild(Object o,
Flag... flags)
|
int |
hashCode()
|
boolean |
isValid()
Tests if a node reference is still valid. |
V |
put(K key,
V value)
Associates the specified value with the specified key for this node. |
V |
put(K key,
V value,
Flag... flags)
|
void |
putAll(Map<? extends K,? extends V> map)
Copies all of the mappings from the specified map to this node's map. |
void |
putAll(Map<? extends K,? extends V> map,
Flag... flags)
|
V |
putIfAbsent(K key,
V value)
If the specified key is not already associated with a value, associate it with the given value, and returns the Object (if any) that occupied the space, or null. |
V |
putIfAbsent(K key,
V value,
Flag... flags)
|
V |
remove(K key)
Removes the mapping for this key from this node if it is present. |
V |
remove(K key,
Flag... flags)
|
boolean |
removeChild(Fqn f)
Removes a child node specified by the given relative Fqn . |
boolean |
removeChild(Fqn f,
Flag... flags)
|
boolean |
removeChild(Object childName)
Removes a child node specified by the given name. |
boolean |
removeChild(Object childName,
Flag... flags)
|
void |
removeChildren()
|
void |
removeChildren(Flag... flags)
|
V |
replace(K key,
V value)
Replace entry for key only if currently mapped to some value. |
V |
replace(K key,
V value,
Flag... flags)
|
boolean |
replace(K key,
V oldValue,
V newValue)
Replace entry for key only if currently mapped to given value. |
boolean |
replace(K key,
V oldValue,
V value,
Flag... flags)
|
void |
replaceAll(Map<? extends K,? extends V> map)
Similar to Node.putAll(java.util.Map) except that it removes any entries that exists in the data map first. |
void |
replaceAll(Map<? extends K,? extends V> map,
Flag... flags)
|
String |
toString()
|
Methods inherited from class org.infinispan.tree.TreeStructureSupport |
---|
exists, getAtomicMap, isLocked, printTree |
Methods inherited from class org.infinispan.batch.AutoBatchSupport |
---|
assertBatchingSupported, endAtomic, startAtomic |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NodeImpl(Fqn fqn, Cache<?,?> cache, BatchContainer batchContainer, InvocationContextContainer icc)
Method Detail |
---|
public Node<K,V> getParent()
Node
null
.
getParent
in interface Node<K,V>
public Node<K,V> getParent(Flag... flags)
getParent
in interface Node<K,V>
public Set<Node<K,V>> getChildren()
Node
getChildren
in interface Node<K,V>
Set
of child nodes. Empty Set
if there aren't any children.public Set<Node<K,V>> getChildren(Flag... flags)
getChildren
in interface Node<K,V>
public Set<Object> getChildrenNames()
Node
getChildrenNames
in interface Node<K,V>
Set
of child node names. Empty Set
if there aren't any children.public Set<Object> getChildrenNames(Flag... flags)
getChildrenNames
in interface Node<K,V>
public Map<K,V> getData()
Node
Node
.
getData
in interface Node<K,V>
Map
containing the data in this Node
. If there is no data, an empty Map
is
returned. The Map
returned is always immutable.public Map<K,V> getData(Flag... flags)
getData
in interface Node<K,V>
public Set<K> getKeys()
Node
Set
containing the data in this Node
.
getKeys
in interface Node<K,V>
Set
containing the data in this Node
. If there is no data, an empty Set
is
returned. The Set
returned is always immutable.public Set<K> getKeys(Flag... flags)
getKeys
in interface Node<K,V>
public Fqn getFqn()
Node
Fqn
which represents the location of this Node
in the cache structure. The Fqn
returned is absolute.
getFqn
in interface Node<K,V>
Fqn
which represents the location of this Node
in the cache structure. The Fqn
returned is absolute.public Node<K,V> addChild(Fqn f)
Node
Fqn
under the current node. Returns the newly created node.
If the child exists returns the child node anyway. Guaranteed to return a non-null node.
The Fqn
passed in is relative to the current node. The new child node will have an absolute fqn
calculated as follows: new Fqn(getFqn(), f). See
Fqn
for the operation of this constructor.
addChild
in interface Node<K,V>
f
- Fqn
of the child node, relative to the current node.
public Node<K,V> addChild(Fqn f, Flag... flags)
addChild
in interface Node<K,V>
public boolean removeChild(Fqn f)
Node
Fqn
.
If you wish to remove children based on absolute Fqn
s, use the TreeCache
interface instead.
removeChild
in interface Node<K,V>
f
- Fqn
of the child node, relative to the current node.
public boolean removeChild(Fqn f, Flag... flags)
removeChild
in interface Node<K,V>
public boolean removeChild(Object childName)
Node
removeChild
in interface Node<K,V>
childName
- name of the child node, directly under the current node.
public boolean removeChild(Object childName, Flag... flags)
removeChild
in interface Node<K,V>
public Node<K,V> getChild(Fqn f)
Node
getChild
in interface Node<K,V>
f
- Fqn
of the child node
public Node<K,V> getChild(Fqn f, Flag... flags)
getChild
in interface Node<K,V>
public Node<K,V> getChild(Object name)
getChild
in interface Node<K,V>
name
- name of the child
public Node<K,V> getChild(Object name, Flag... flags)
getChild
in interface Node<K,V>
public V put(K key, V value)
Node
put
in interface Node<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
public V put(K key, V value, Flag... flags)
put
in interface Node<K,V>
public V putIfAbsent(K key, V value)
Node
if (!node.getKeys().contains(key)) return node.put(key, value); else return node.get(key);except that this is atomic.
putIfAbsent
in interface Node<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
public V putIfAbsent(K key, V value, Flag... flags)
putIfAbsent
in interface Node<K,V>
public V replace(K key, V value)
Node
if ((node.getKeys().contains(key)) { return node.put(key, value); } else return null;except that this is atomic.
replace
in interface Node<K,V>
key
- key with which the specified value is associated.value
- value to be associated with the specified key.
public V replace(K key, V value, Flag... flags)
replace
in interface Node<K,V>
public boolean replace(K key, V oldValue, V newValue)
Node
if (node.get(key).equals(oldValue)) { node.put(key, newValue); return true; } else return false;except that this is atomic.
replace
in interface Node<K,V>
key
- key with which the specified value is associated.oldValue
- value expected to be associated with the specified key.newValue
- value to be associated with the specified key.
public boolean replace(K key, V oldValue, V value, Flag... flags)
replace
in interface Node<K,V>
public void putAll(Map<? extends K,? extends V> map)
Node
Node node; for (Map.Entry me : map.entrySet()) node.put(me.getKey(), me.getValue());
putAll
in interface Node<K,V>
map
- map to copy frompublic void putAll(Map<? extends K,? extends V> map, Flag... flags)
putAll
in interface Node<K,V>
public void replaceAll(Map<? extends K,? extends V> map)
Node
Node.putAll(java.util.Map)
except that it removes any entries that exists in the data map first.
Note that this happens atomically, under a single lock. This is the analogous to doing a Node.clearData()
followed by a Node.putAll(java.util.Map)
in the same transaction.
replaceAll
in interface Node<K,V>
map
- map to copy frompublic void replaceAll(Map<? extends K,? extends V> map, Flag... flags)
replaceAll
in interface Node<K,V>
public V get(K key)
Node
null
if the node contains no
mapping for this key.
get
in interface Node<K,V>
key
- key of the data to return
null
if the map contains no mapping
for this keypublic V get(K key, Flag... flags)
get
in interface Node<K,V>
public V remove(K key)
Node
null
if the node contained no mapping for this key
remove
in interface Node<K,V>
key
- key whose mapping is to be removed
null
if there was no mapping for keypublic V remove(K key, Flag... flags)
remove
in interface Node<K,V>
public void clearData()
Node
clearData
in interface Node<K,V>
public void clearData(Flag... flags)
clearData
in interface Node<K,V>
public int dataSize()
dataSize
in interface Node<K,V>
public int dataSize(Flag... flags)
dataSize
in interface Node<K,V>
public boolean hasChild(Fqn f)
Node
Fqn
passed in exists.
hasChild
in interface Node<K,V>
f
- Fqn
relative to the current node of the child you are testing the existence of.
Fqn
passed in exists.public boolean hasChild(Fqn f, Flag... flags)
hasChild
in interface Node<K,V>
public boolean hasChild(Object o)
Node
hasChild
in interface Node<K,V>
o
- name of the child, relative to the current node
public boolean hasChild(Object o, Flag... flags)
hasChild
in interface Node<K,V>
public boolean isValid()
Node
NodeNotValidException
.
isValid
in interface Node<K,V>
public void removeChildren()
removeChildren
in interface Node<K,V>
public void removeChildren(Flag... flags)
removeChildren
in interface Node<K,V>
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |