org.sapia.archie
Interface Node

All Known Implementing Classes:
AbstractNode, AttributeNode, DefaultNode, MultiValueNode, SingleValueNode, SynchronizedNode

public interface Node

This interface specifies the behavior of "nodes". Nodes hold child nodes that are bound to their parent with a given name. Nodes also hold values, that are arbitrary objects also bound to their parent node using a given name.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Method Summary
 Node createChild(NamePart name)
          Creates the node corresponding to the given name and returns it.
 Name getAbsolutePath()
          Returns the full path to this node, starting from the root.
 Node getChild(NamePart name)
          Returns the node with the given name.
 java.util.Iterator getChildren()
          Returns this instance's child nodes.
 int getChildrenCount()
          Returns the number of children that this instance contains.
 java.util.Iterator getChildrenNames()
          Returns the names of this instance's nodes.
 java.util.Iterator getEntries()
           
 NamePart getName()
          Return this instance's name.
 NameParser getNameParser()
          Returns this implementation's name parser.
 Node getParent()
          Returns this instance's parent.
 java.lang.Object getValue(NamePart name)
          Returns this node's value.
 int getValueCount()
          Returns the number of values that this instance contains.
 java.util.Iterator getValueNames()
          Returns the names of this instance's values.
 boolean putValue(NamePart name, java.lang.Object value, boolean overwrite)
          Put a value into this node; overwrites the existing value - if any.
 Node removeChild(NamePart name)
          Removes the node with the given name.
 java.lang.Object removeValue(NamePart name)
          Internally removes the value that this node holds and returns it.
 void setUp(Node parent, NamePart nodeName)
          Sets this node's name and parent node.
 

Method Detail

getValue

java.lang.Object getValue(NamePart name)
Returns this node's value.

Returns:
an Object, or null if this node has no value.

removeValue

java.lang.Object removeValue(NamePart name)
Internally removes the value that this node holds and returns it.

Returns:
an Object, or null if this node has no value.

putValue

boolean putValue(NamePart name,
                 java.lang.Object value,
                 boolean overwrite)
Put a value into this node; overwrites the existing value - if any.

Parameters:
name - the name under which to bind the given value.
value - an Object.
overwrite - if true, overwrites the already existing value for the given name - it such is the case.
Returns:
true if the given value was added. Returns false if overwrite is false and a value already exists for the given name.

getValueNames

java.util.Iterator getValueNames()
Returns the names of this instance's values.

Returns:
an Iterator of NameParts.

getValueCount

int getValueCount()
Returns the number of values that this instance contains.

Returns:
the number of values that this instance contains.

setUp

void setUp(Node parent,
           NamePart nodeName)
Sets this node's name and parent node. Client applications must not use this method - unless they know what they are doing.

Parameters:
parent - this instance's parent Node
nodeName - a NamePart.

getAbsolutePath

Name getAbsolutePath()
Returns the full path to this node, starting from the root.

Returns:
a Name.

getParent

Node getParent()
Returns this instance's parent.

Returns:
a Node.

getName

NamePart getName()
Return this instance's name.

Returns:
a NamePart.

createChild

Node createChild(NamePart name)
                 throws DuplicateException,
                        ProcessingException
Creates the node corresponding to the given name and returns it.

Parameters:
name - a NamePart
Returns:
a Node.
Throws:
DuplicateException - if a node exists for the given name.
ProcessingException

getChild

Node getChild(NamePart name)
Returns the node with the given name.

Parameters:
name - a NamePart corresponding to the name of an existing child node.
Returns:
a Node or null if not child exists for the given name.

removeChild

Node removeChild(NamePart name)
Removes the node with the given name.

Parameters:
name - a NamePart corresponding to the name of an existing child node.
Returns:
a Node or null if not child exists for the given name.

getChildren

java.util.Iterator getChildren()
Returns this instance's child nodes.

Returns:
a Iterator of Nodes.

getChildrenCount

int getChildrenCount()
Returns the number of children that this instance contains.

Returns:
the number of children that this instance contains.

getEntries

java.util.Iterator getEntries()
Returns:
an Iterator of Entry instances, corresponding to the bindings that this instance holds.

getChildrenNames

java.util.Iterator getChildrenNames()
Returns the names of this instance's nodes.

Returns:
an Iterator of NameParts.

getNameParser

NameParser getNameParser()
Returns this implementation's name parser.

Returns:
a NameParser.


Copyright © 2010 Sapia OSS. All Rights Reserved.