org.planx.xmlstore.koala.nodes
Class DVMElementNode

java.lang.Object
  extended by org.planx.xmlstore.koala.nodes.AbstractDVMNode
      extended by org.planx.xmlstore.koala.nodes.DVMElementNode
All Implemented Interfaces:
SystemNode, Node

public class DVMElementNode
extends AbstractDVMNode

An immutable ELEMENT node.

Author:
Thomas Ambus

Field Summary
 
Fields inherited from interface org.planx.xmlstore.Node
BINARY, CHARDATA, ELEMENT
 
Constructor Summary
DVMElementNode(String value)
           
DVMElementNode(String value, List<SystemNode> children, List<Attribute> attrs)
           
DVMElementNode(String value, SystemNode[] children, Attribute[] attrs)
           
 
Method Summary
 boolean equals(Object o)
          Returns true if and only if the specified object is also a Node, they have the same type, their node values are equal, their attributes are equals as a set, and their children are recursively equal according to this definition.
 String getAttribute(String attrName)
          Returns the attribute with the given name.
 String[] getAttributeNames()
          Returns the names of this Node's attributes.
 List<Attribute> getAttributes()
          Returns the attributes of this Node.
 List<SystemNode> getChildren()
          Returns the children of this Node.
 String getNodeValue()
          Returns the value of this Node.
 int hashCode()
          Recursively computes a hash code based on the node type, node value, attributes, and children.
static DVMElementNode uncheckedNode(String value, List<SystemNode> children, List<Attribute> attrs, Locator loc, boolean isShared)
          Returns a new DVMElementNode where the child and attribute lists are not checked for immutability or copied during construction.
 
Methods inherited from class org.planx.xmlstore.koala.nodes.AbstractDVMNode
contentEquals, getBytes, getLocator, getType, getValueReference, isMutable, isShared, setLocator, setValueReference, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DVMElementNode

public DVMElementNode(String value)

DVMElementNode

public DVMElementNode(String value,
                      List<SystemNode> children,
                      List<Attribute> attrs)

DVMElementNode

public DVMElementNode(String value,
                      SystemNode[] children,
                      Attribute[] attrs)
Method Detail

uncheckedNode

public static DVMElementNode uncheckedNode(String value,
                                           List<SystemNode> children,
                                           List<Attribute> attrs,
                                           Locator loc,
                                           boolean isShared)
Returns a new DVMElementNode where the child and attribute lists are not checked for immutability or copied during construction. This special way to construct an element node is provided for efficiency in implementing system applications which may otherwise ensure that the lists are immutable.


getNodeValue

public String getNodeValue()
Description copied from interface: Node
Returns the value of this Node. When the node represents a character data node, the returned value will be the character data. When the node represents an element node, the returned value will by the tag name of the element. When the node represents binary data, the returned value will be a base64 encoding of the data.

Returns:
The node value.

getChildren

public List<SystemNode> getChildren()
Description copied from interface: Node
Returns the children of this Node. If the node represents character data the empty list is returned.

Returns:
An immutable list of the children of this Node.

getAttributes

public List<Attribute> getAttributes()
Description copied from interface: Node
Returns the attributes of this Node. In case the node represents character data, the empty list is returned.

Returns:
An immutable list of the attributes of this Node.

getAttribute

public String getAttribute(String attrName)
Description copied from interface: Node
Returns the attribute with the given name. In case the node represents a character data node the returned value is null.

Returns:
The attribute named by the argument.

getAttributeNames

public String[] getAttributeNames()
Description copied from interface: Node
Returns the names of this Node's attributes. If the node represents character data the returned array is empty.

Returns:
The attribute names of the node.

equals

public boolean equals(Object o)
Description copied from interface: Node
Returns true if and only if the specified object is also a Node, they have the same type, their node values are equal, their attributes are equals as a set, and their children are recursively equal according to this definition.

Specified by:
equals in interface Node
Overrides:
equals in class Object

hashCode

public int hashCode()
Description copied from interface: Node
Recursively computes a hash code based on the node type, node value, attributes, and children.

Specified by:
hashCode in interface Node
Overrides:
hashCode in class Object


Copyright © 2004-2005 Plan-X. All Rights Reserved.