org.jboss.cache
Class AbstractNode<K,V>

java.lang.Object
  extended by org.jboss.cache.AbstractNode<K,V>
Direct Known Subclasses:
UnversionedNode, WorkspaceNodeImpl

public abstract class AbstractNode<K,V>
extends Object

Base class for UnversionedNode.

Author:
manik

Nested Class Summary
static class AbstractNode.NodeFlags
          These flags were originally stored as booleans on the UnversionedNode class.
 
Field Summary
protected  ConcurrentMap children
           
protected  short flags
          Flags placed on the node.
protected  Fqn fqn
           
 
Constructor Summary
AbstractNode()
           
 
Method Summary
 void addChild(InternalNode<K,V> child)
           
 void addChild(InternalNode<K,V> child, boolean safe)
           
 void addChild(Object nodeName, InternalNode<K,V> nodeToAdd)
           
 NodeSPI<K,V> addChildDirect(Fqn f)
           
 NodeSPI<K,V> addChildDirect(Fqn f, boolean notify)
           
 void addChildDirect(NodeSPI<K,V> child)
           
 NodeSPI<K,V> addChildDirect(Object o, boolean notify)
           
 void addChildDirect(Object nodeName, Node<K,V> nodeToAdd)
           
 boolean equals(Object another)
           
 InternalNode<K,V> getChild(Fqn f)
           
 InternalNode<K,V> getChild(Object childName)
           
 NodeSPI<K,V> getChildDirect(Fqn fqn)
           
 NodeSPI<K,V> getChildDirect(Object childName)
           
 Set<InternalNode<K,V>> getChildren()
           
 Set<InternalNode<K,V>> getChildren(boolean includeMarkedForRemoval)
           
 Set<NodeSPI<K,V>> getChildrenDirect()
           
 Set<NodeSPI<K,V>> getChildrenDirect(boolean includeMarkedForRemoval)
           
 Map<Object,InternalNode<K,V>> getChildrenMap()
           
 Map<Object,Node<K,V>> getChildrenMapDirect()
           
 IdentityLock getLock()
           
 NodeSPI<K,V> getOrCreateChild(Object childName, GlobalTransaction gtx)
           
 DataVersion getVersion()
           
 int hashCode()
           
protected  boolean isFlagSet(AbstractNode.NodeFlags flag)
          Tests whether a flag is set.
 boolean isRemoved()
           
 boolean isResident()
           
abstract  void markAsRemoved(boolean marker, boolean recursive)
           
 void setChildrenMap(ConcurrentMap<Object,InternalNode<K,V>> children)
           
 void setChildrenMapDirect(Map<Object,Node<K,V>> children)
           
protected  void setFlag(AbstractNode.NodeFlags flag)
          Unility method that sets the value of the given flag to true.
protected  void setFlag(AbstractNode.NodeFlags flag, boolean value)
          Utility method for setting or unsetting a flag.
 void setRemoved(boolean marker)
           
 void setResident(boolean resident)
           
 void setVersion(DataVersion version)
           
protected  void unsetFlag(AbstractNode.NodeFlags flag)
          Utility method that sets the value of the flag to false.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected ConcurrentMap children

fqn

protected Fqn fqn

flags

protected short flags
Flags placed on the node. Replaces older 'boolean' flags.

Constructor Detail

AbstractNode

public AbstractNode()
Method Detail

isFlagSet

protected final boolean isFlagSet(AbstractNode.NodeFlags flag)
Tests whether a flag is set.

Parameters:
flag - flag to test
Returns:
true if set, false otherwise.

setFlag

protected final void setFlag(AbstractNode.NodeFlags flag,
                             boolean value)
Utility method for setting or unsetting a flag. If status is true, the NodeFlag specified is added to the flags encoded short. If status is false, the NodeFlag is removed from the encoded short.

Parameters:
flag - flag to set or unset
value - true to set the flag, false to unset the flag.

setFlag

protected final void setFlag(AbstractNode.NodeFlags flag)
Unility method that sets the value of the given flag to true.

Parameters:
flag - flag to set

unsetFlag

protected final void unsetFlag(AbstractNode.NodeFlags flag)
Utility method that sets the value of the flag to false.

Parameters:
flag - flag to unset

isRemoved

public boolean isRemoved()

setResident

public void setResident(boolean resident)

setRemoved

public void setRemoved(boolean marker)

markAsRemoved

public abstract void markAsRemoved(boolean marker,
                                   boolean recursive)

isResident

public boolean isResident()

getLock

public IdentityLock getLock()

setVersion

public void setVersion(DataVersion version)

getVersion

public DataVersion getVersion()

equals

public boolean equals(Object another)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getChild

public InternalNode<K,V> getChild(Fqn f)

getChild

public InternalNode<K,V> getChild(Object childName)

getChildren

public Set<InternalNode<K,V>> getChildren()

getChildren

public Set<InternalNode<K,V>> getChildren(boolean includeMarkedForRemoval)

getChildrenMap

public Map<Object,InternalNode<K,V>> getChildrenMap()

addChild

public void addChild(Object nodeName,
                     InternalNode<K,V> nodeToAdd)

addChild

public void addChild(InternalNode<K,V> child)

addChild

public void addChild(InternalNode<K,V> child,
                     boolean safe)

setChildrenMap

public void setChildrenMap(ConcurrentMap<Object,InternalNode<K,V>> children)

getChildDirect

public NodeSPI<K,V> getChildDirect(Fqn fqn)

getChildDirect

public NodeSPI<K,V> getChildDirect(Object childName)

getChildrenDirect

public Set<NodeSPI<K,V>> getChildrenDirect()

getChildrenDirect

public Set<NodeSPI<K,V>> getChildrenDirect(boolean includeMarkedForRemoval)

getChildrenMapDirect

public Map<Object,Node<K,V>> getChildrenMapDirect()

setChildrenMapDirect

public void setChildrenMapDirect(Map<Object,Node<K,V>> children)

addChildDirect

public void addChildDirect(Object nodeName,
                           Node<K,V> nodeToAdd)

addChildDirect

public void addChildDirect(NodeSPI<K,V> child)

addChildDirect

public NodeSPI<K,V> addChildDirect(Fqn f)

addChildDirect

public NodeSPI<K,V> addChildDirect(Fqn f,
                                   boolean notify)

addChildDirect

public NodeSPI<K,V> addChildDirect(Object o,
                                   boolean notify)

getOrCreateChild

public NodeSPI<K,V> getOrCreateChild(Object childName,
                                     GlobalTransaction gtx)


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.