org.modeshape.graph.connector.inmemory
Class InMemoryNode

java.lang.Object
  extended by org.modeshape.graph.connector.map.DefaultMapNode
      extended by org.modeshape.graph.connector.inmemory.InMemoryNode
All Implemented Interfaces:
MapNode

public class InMemoryNode
extends DefaultMapNode

An MapNode implementation used by the InMemoryRepository.


Nested Class Summary
static interface InMemoryNode.ChangeListener
          The interface that InMemoryNode objects use to signal when they are about to change.
 
Constructor Summary
InMemoryNode(InMemoryNode.ChangeListener listener, UUID uuid)
           
 
Method Summary
 void addChild(int index, MapNode child)
          Inserts the specified child at the specified position in the list of children.
 void addChild(MapNode child)
          Adds the given child to the end of the list of children for this node
 void clearChildren()
          Removes all of the children for this node in a single operation.
 boolean removeChild(MapNode child)
          Removes the given child from the list of children
 MapNode removeProperty(Name propertyName)
          Removes the property with the given name
 void setName(Path.Segment name)
          
 void setParent(MapNode parent)
          
 MapNode setProperties(Iterable<Property> properties)
          Sets the given properties in a single operation, overwriting any previous properties for the same name This bulk mutator should be used when multiple properties are being set in order to allow underlying implementations to optimize their access to their respective persistent storage mechanism.
 MapNode setProperty(ExecutionContext context, String name, Object... values)
          Sets the property with the given name, overwriting any previous property for the given name
 MapNode setProperty(Property property)
          Sets the property with the given name, overwriting any previous property for the given name
 
Methods inherited from class org.modeshape.graph.connector.map.DefaultMapNode
equals, getChildren, getName, getParent, getProperties, getProperty, getProperty, getUniqueChildNames, getUuid, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InMemoryNode

public InMemoryNode(InMemoryNode.ChangeListener listener,
                    UUID uuid)
Parameters:
listener - the listener that is to be notified of any changes
uuid - the UUID of the node
Method Detail

addChild

public void addChild(int index,
                     MapNode child)
Inserts the specified child at the specified position in the list of children. Shifts the child currently at that position (if any) and any subsequent children to the right (adds one to their indices).

Specified by:
addChild in interface MapNode
Overrides:
addChild in class DefaultMapNode
Parameters:
index - index at which the specified child is to be inserted
child - the child to be inserted
See Also:
DefaultMapNode.addChild(int, org.modeshape.graph.connector.map.MapNode)

addChild

public void addChild(MapNode child)
Adds the given child to the end of the list of children for this node

Specified by:
addChild in interface MapNode
Overrides:
addChild in class DefaultMapNode
Parameters:
child - the child to add to this node
See Also:
DefaultMapNode.addChild(org.modeshape.graph.connector.map.MapNode)

clearChildren

public void clearChildren()
Removes all of the children for this node in a single operation.

Specified by:
clearChildren in interface MapNode
Overrides:
clearChildren in class DefaultMapNode
See Also:
DefaultMapNode.clearChildren()

removeChild

public boolean removeChild(MapNode child)
Removes the given child from the list of children

Specified by:
removeChild in interface MapNode
Overrides:
removeChild in class DefaultMapNode
Parameters:
child - the child to be removed
Returns:
true if the child was one of this node's children (and was removed); false otherwise
See Also:
DefaultMapNode.removeChild(org.modeshape.graph.connector.map.MapNode)

removeProperty

public MapNode removeProperty(Name propertyName)
Removes the property with the given name

Specified by:
removeProperty in interface MapNode
Overrides:
removeProperty in class DefaultMapNode
Parameters:
propertyName - the name of the property to remove
Returns:
this map node
See Also:
DefaultMapNode.removeProperty(org.modeshape.graph.property.Name)

setName

public void setName(Path.Segment name)

Specified by:
setName in interface MapNode
Overrides:
setName in class DefaultMapNode
Parameters:
name - Sets name to the specified value.
See Also:
DefaultMapNode.setName(org.modeshape.graph.property.Path.Segment)

setParent

public void setParent(MapNode parent)

Specified by:
setParent in interface MapNode
Overrides:
setParent in class DefaultMapNode
Parameters:
parent - Sets parent to the specified value.
See Also:
DefaultMapNode.setParent(org.modeshape.graph.connector.map.MapNode)

setProperties

public MapNode setProperties(Iterable<Property> properties)
Sets the given properties in a single operation, overwriting any previous properties for the same name This bulk mutator should be used when multiple properties are being set in order to allow underlying implementations to optimize their access to their respective persistent storage mechanism.

Specified by:
setProperties in interface MapNode
Overrides:
setProperties in class DefaultMapNode
Parameters:
properties - the properties to set
Returns:
this map node
See Also:
DefaultMapNode.setProperties(java.lang.Iterable)

setProperty

public MapNode setProperty(ExecutionContext context,
                           String name,
                           Object... values)
Sets the property with the given name, overwriting any previous property for the given name

Specified by:
setProperty in interface MapNode
Overrides:
setProperty in class DefaultMapNode
Parameters:
context - the current execution context, used to get a name factory and property factory.
name - the name of the property
values - the values for the property
Returns:
this map node
See Also:
DefaultMapNode.setProperty(org.modeshape.graph.ExecutionContext, java.lang.String, java.lang.Object[])

setProperty

public MapNode setProperty(Property property)
Sets the property with the given name, overwriting any previous property for the given name

Specified by:
setProperty in interface MapNode
Overrides:
setProperty in class DefaultMapNode
Parameters:
property - the property to set
Returns:
this map node
See Also:
DefaultMapNode.setProperty(org.modeshape.graph.property.Property)


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.