org.sapia.archie
Class AbstractNode

java.lang.Object
  extended by org.sapia.archie.AbstractNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
MultiValueNode, SingleValueNode

public abstract class AbstractNode
extends java.lang.Object
implements Node

Abstract implementation of the Node interface.

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

Field Summary
protected  java.util.Map _children
           
protected  NodeFactory _fac
           
 
Constructor Summary
protected AbstractNode(java.util.Map children, NodeFactory fac)
           
protected AbstractNode(NameParser parser, java.util.Map children, NodeFactory fac)
           
 
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.
 NamePart getName()
          Return this instance's name.
 NameParser getNameParser()
          Returns this implementation's name parser.
 Node getParent()
          Returns this instance's parent.
 Node removeChild(NamePart name)
          Removes the node with the given name.
 void setUp(Node parent, NamePart name)
          Sets this node's name and parent node.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.sapia.archie.Node
getEntries, getValue, getValueCount, getValueNames, putValue, removeValue
 

Field Detail

_children

protected java.util.Map _children

_fac

protected NodeFactory _fac
Constructor Detail

AbstractNode

protected AbstractNode(NameParser parser,
                       java.util.Map children,
                       NodeFactory fac)
                throws ProcessingException
Throws:
ProcessingException

AbstractNode

protected AbstractNode(java.util.Map children,
                       NodeFactory fac)
                throws ProcessingException
Throws:
ProcessingException
Method Detail

createChild

public Node createChild(NamePart name)
                 throws DuplicateException,
                        ProcessingException
Description copied from interface: Node
Creates the node corresponding to the given name and returns it.

Specified by:
createChild in interface Node
Parameters:
name - a NamePart
Returns:
a Node.
Throws:
DuplicateException - if a node exists for the given name.
ProcessingException
See Also:
Node.createChild(NamePart)

getChild

public Node getChild(NamePart name)
Description copied from interface: Node
Returns the node with the given name.

Specified by:
getChild in interface Node
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.
See Also:
Node.getChild(NamePart)

removeChild

public Node removeChild(NamePart name)
Description copied from interface: Node
Removes the node with the given name.

Specified by:
removeChild in interface Node
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.
See Also:
Node.removeChild(org.sapia.archie.NamePart)

getChildren

public java.util.Iterator getChildren()
Description copied from interface: Node
Returns this instance's child nodes.

Specified by:
getChildren in interface Node
Returns:
a Iterator of Nodes.
See Also:
Node.getChildren()

getName

public NamePart getName()
Description copied from interface: Node
Return this instance's name.

Specified by:
getName in interface Node
Returns:
a NamePart.
See Also:
Node.getName()

getAbsolutePath

public Name getAbsolutePath()
Description copied from interface: Node
Returns the full path to this node, starting from the root.

Specified by:
getAbsolutePath in interface Node
Returns:
a Name.
See Also:
Node.getAbsolutePath()

getChildrenCount

public int getChildrenCount()
Description copied from interface: Node
Returns the number of children that this instance contains.

Specified by:
getChildrenCount in interface Node
Returns:
the number of children that this instance contains.
See Also:
Node.getChildrenCount()

getChildrenNames

public java.util.Iterator getChildrenNames()
Description copied from interface: Node
Returns the names of this instance's nodes.

Specified by:
getChildrenNames in interface Node
Returns:
an Iterator of NameParts.
See Also:
Node.getChildrenNames()

getParent

public Node getParent()
Description copied from interface: Node
Returns this instance's parent.

Specified by:
getParent in interface Node
Returns:
a Node.
See Also:
Node.getParent()

getNameParser

public NameParser getNameParser()
Description copied from interface: Node
Returns this implementation's name parser.

Specified by:
getNameParser in interface Node
Returns:
a NameParser.
See Also:
Node.getNameParser()

setUp

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

Specified by:
setUp in interface Node
Parameters:
parent - this instance's parent Node
name - a NamePart.
See Also:
Node.setUp(Node, NamePart)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010 Sapia OSS. All Rights Reserved.