org.sapia.archie
Interface Node

All Known Implementing Classes:
AbstractNode, 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.
 Iterator getChildren()
          Returns this instance's child nodes.
 int getChildrenCount()
          Returns the number of children that this instance contains.
 Iterator getChildrenNames()
          Returns the names of this instance's nodes.
 Iterator getEntries()
           
 NamePart getName()
          Return this instance's name.
 NameParser getNameParser()
          Returns this implementation's name parser.
 Node getParent()
          Returns this instance's parent.
 Object getValue(NamePart name)
          Returns this node's value.
 int getValueCount()
          Returns the number of values that this instance contains.
 Iterator getValueNames()
          Returns the names of this instance's values.
 boolean putValue(NamePart name, 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.
 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

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

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

removeValue

public 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

public boolean putValue(NamePart name,
                        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

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

Returns:
an Iterator of NameParts.

getValueCount

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

Returns:
the number of values that this instance contains.

setUp

public 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

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

Returns:
a Name.

getParent

public Node getParent()
Returns this instance's parent.

Returns:
a Node.

getName

public NamePart getName()
Return this instance's name.

Returns:
a NamePart.

createChild

public 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

public 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

public 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

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

Returns:
a Iterator of Nodes.

getChildrenCount

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

Returns:
the number of children that this instance contains.

getEntries

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

getChildrenNames

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

Returns:
an Iterator of NameParts.

getNameParser

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

Returns:
a NameParser.


Copyright © 2002 Sapia Open Community, Inc. All Rights Reserved.