org.planx.xmlstore.nodes
Class DVMNode

java.lang.Object
  extended by org.planx.xmlstore.nodes.AbstractNode
      extended by org.planx.xmlstore.nodes.DVMNode
All Implemented Interfaces:
EquivalenceClassDiscriminable, Node, SystemNode

public class DVMNode
extends AbstractNode

Standard implementation of an immutable Node.

Author:
Kasper Bøgebjerg, Henning Niss, Thomas Ambus

Field Summary
 
Fields inherited from class org.planx.xmlstore.nodes.AbstractNode
eqCls, ref, visitToken
 
Fields inherited from interface org.planx.xmlstore.Node
CHARDATA, ELEMENT
 
Constructor Summary
DVMNode(byte type, String value)
           
DVMNode(byte type, String value, List<SystemNode> children, List<Attribute> attrs)
           
DVMNode(byte type, 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.
 SystemNode get()
          Resolves the node if it is a proxy and guarantees to return a 'real' node.
 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.
 int getHeight()
           
 LocalLocator getLocator()
           
 String getNodeValue()
          Returns the value of this Node.
 byte getType()
          Returns the node type of this Node.
 int hashCode()
          Recursively computes a hash code based on the node type, node value, attributes, and children.
 boolean isMutable()
          Returns true if this Node is mutable, false otherwise.
 boolean isShared()
           
 void setChild(int index, SystemNode child)
           
 void setHeight(int height)
           
 void setLocator(LocalLocator loc)
           
 void setShared(boolean isShared)
           
 String toString()
           
 
Methods inherited from class org.planx.xmlstore.nodes.AbstractNode
getEquivalenceClass, getReference, getVisitToken, setEquivalenceClass, setReference, setVisitToken
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DVMNode

public DVMNode(byte type,
               String value)

DVMNode

public DVMNode(byte type,
               String value,
               List<SystemNode> children,
               List<Attribute> attrs)

DVMNode

public DVMNode(byte type,
               String value,
               SystemNode[] children,
               Attribute[] attrs)
Method Detail

isMutable

public boolean isMutable()
Description copied from interface: Node
Returns true if this Node is mutable, false otherwise.

Specified by:
isMutable in interface Node
Overrides:
isMutable in class AbstractNode
Returns:
true if mutable, false if immutable.

getType

public byte getType()
Description copied from interface: Node
Returns the node type of this Node.

Returns:
The node type

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.

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

toString

public String toString()
Overrides:
toString in class Object

get

public SystemNode get()
Description copied from interface: SystemNode
Resolves the node if it is a proxy and guarantees to return a 'real' node.

Specified by:
get in interface SystemNode
Overrides:
get in class AbstractNode

isShared

public boolean isShared()

setShared

public void setShared(boolean isShared)

getHeight

public int getHeight()

setHeight

public void setHeight(int height)

setChild

public void setChild(int index,
                     SystemNode child)

getLocator

public LocalLocator getLocator()

setLocator

public void setLocator(LocalLocator loc)


Copyright © 2010. All Rights Reserved.