org.planx.xmlstore.koala.nodes
Class DVMBinaryNode

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

public class DVMBinaryNode
extends AbstractDVMNode

An immutable BINARY node.

Author:
Thomas Ambus

Field Summary
 
Fields inherited from interface org.planx.xmlstore.Node
BINARY, CHARDATA, ELEMENT
 
Constructor Summary
DVMBinaryNode(byte[] value)
          Creates a BINARY node with the specified value.
DVMBinaryNode(byte[] value, Locator loc, boolean isShared)
          Creates a BINARY node and sets its associated locator and isShared status.
 
Method Summary
 boolean equals(Object o)
          Only equal if object is a Node with the same type and same value.
 String getAttribute(String attrName)
          Always null.
 String[] getAttributeNames()
          Empty array.
 List<Attribute> getAttributes()
          Empty list.
 byte[] getBytes()
          Returns the data of this BINARY node.
 List<SystemNode> getChildren()
          Empty list.
 String getNodeValue()
          Returns the data of this BINARY node encoded as base64.
 int hashCode()
          Recursively computes a hash code based on the node type, node value, attributes, and children.
 void setChild(int index, SystemNode child)
          Throws an IllegalArgumentException since BINARY nodes cannot have children.
 
Methods inherited from class org.planx.xmlstore.koala.nodes.AbstractDVMNode
contentEquals, getLocator, getType, getValueReference, isMutable, isShared, setLocator, setValueReference, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DVMBinaryNode

public DVMBinaryNode(byte[] value)
Creates a BINARY node with the specified value.


DVMBinaryNode

public DVMBinaryNode(byte[] value,
                     Locator loc,
                     boolean isShared)
Creates a BINARY node and sets its associated locator and isShared status.

Method Detail

getNodeValue

public String getNodeValue()
Returns the data of this BINARY node encoded as base64.

Returns:
The node value.

getBytes

public byte[] getBytes()
Returns the data of this BINARY node.

Specified by:
getBytes in interface Node
Overrides:
getBytes in class AbstractDVMNode

getChildren

public List<SystemNode> getChildren()
Empty list.

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

getAttributes

public List<Attribute> getAttributes()
Empty list.

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

getAttribute

public String getAttribute(String attrName)
Always null.

Returns:
The attribute named by the argument.

getAttributeNames

public String[] getAttributeNames()
Empty array.

Returns:
The attribute names of the node.

equals

public boolean equals(Object o)
Only equal if object is a Node with the same type and same value.

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

setChild

public void setChild(int index,
                     SystemNode child)
Throws an IllegalArgumentException since BINARY nodes cannot have children.



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