org.exist.dom
Class StoredNode

java.lang.Object
  extended by org.exist.dom.NodeImpl
      extended by org.exist.dom.StoredNode
All Implemented Interfaces:
QNameable, Visitable, Node
Direct Known Subclasses:
CharacterDataImpl, DocumentTypeImpl, NamedNode, ProcessingInstructionImpl

public class StoredNode
extends NodeImpl
implements Visitable

The base class for all persistent DOM nodes in the database.

Author:
Wolfgang Meier

Field Summary
static int LENGTH_SIGNATURE_LENGTH
           
static long UNKNOWN_NODE_IMPL_ADDRESS
           
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
StoredNode(NodeProxy other)
          Creates a new StoredNode instance.
StoredNode(short nodeType)
          Creates a new StoredNode instance.
StoredNode(short nodeType, NodeId nodeId)
          Creates a new StoredNode instance.
StoredNode(StoredNode other)
          Copy constructor: creates a copy of the other node.
 
Method Summary
 boolean accept(Iterator iterator, NodeVisitor visitor)
          Visit the current node.
 boolean accept(NodeVisitor visitor)
           
 void clear()
          Reset this object to its initial state.
static StoredNode deserialize(byte[] data, int start, int len, DocumentImpl doc)
          Read a node from the specified byte array.
static StoredNode deserialize(byte[] data, int start, int len, DocumentImpl doc, boolean pooled)
          Read a node from the specified byte array.
 boolean equals(Object obj)
           
 int getDocId()
           
 DocumentImpl getDocument()
           
 long getInternalAddress()
          Get the internal storage address of this node
 Node getNextSibling()
           
 NodeId getNodeId()
          The method getNodeId
 short getNodeType()
           
 Document getOwnerDocument()
           
 Node getParentNode()
           
 NodePath getPath()
           
 NodePath getPath(NodePath parentPath)
           
 Node getPreviousSibling()
           
 QName getQName()
           
 boolean isDirty()
          Returns true if the node was modified recently and nodes were inserted at the start or in the middle of its children.
 void release()
          Release all memory resources hold by this node.
 byte[] serialize()
           
 void setDirty(boolean dirty)
           
 void setInternalAddress(long internalAddress)
          Set the internal storage address of this node.
 void setNodeId(NodeId dln)
          The method setNodeId
 void setOwnerDocument(DocumentImpl ownerDocument)
          Set the owner document.
 String toString()
           
 String toString(boolean top)
           
 
Methods inherited from class org.exist.dom.NodeImpl
appendChild, appendChildren, cloneNode, compareDocumentPosition, getAttributes, getAttributesCount, getBaseURI, getChildCount, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNodeName, getNodeValue, getPrefix, getTextContent, getUserData, hasAttributes, hasChildNodes, insertAfter, insertAfter, insertBefore, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, removeChild, replaceChild, replaceChild, setAttributes, setNodeName, setNodeValue, setPrefix, setTextContent, setUserData, supports, updateChild, updateChild
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LENGTH_SIGNATURE_LENGTH

public static final int LENGTH_SIGNATURE_LENGTH
See Also:
Constant Field Values

UNKNOWN_NODE_IMPL_ADDRESS

public static final long UNKNOWN_NODE_IMPL_ADDRESS
See Also:
Constant Field Values
Constructor Detail

StoredNode

public StoredNode(short nodeType)
Creates a new StoredNode instance.

Parameters:
nodeType - a short value

StoredNode

public StoredNode(short nodeType,
                  NodeId nodeId)
Creates a new StoredNode instance.

Parameters:
nodeType - a short value
nodeId - a NodeId value

StoredNode

public StoredNode(StoredNode other)
Copy constructor: creates a copy of the other node.

Parameters:
other - a StoredNode value

StoredNode

public StoredNode(NodeProxy other)
Creates a new StoredNode instance.

Parameters:
other - a NodeProxy value
Method Detail

clear

public void clear()
Reset this object to its initial state. Required by the parser to be able to reuse node objects.


serialize

public byte[] serialize()

deserialize

public static StoredNode deserialize(byte[] data,
                                     int start,
                                     int len,
                                     DocumentImpl doc)
Read a node from the specified byte array. This checks the node type and calls the deserialize(byte[], int, int,DocumentImpl,boolean) method of the corresponding node class.

Parameters:
data -
start -
len -
doc -

deserialize

public static StoredNode deserialize(byte[] data,
                                     int start,
                                     int len,
                                     DocumentImpl doc,
                                     boolean pooled)
Read a node from the specified byte array. This checks the node type and calls the deserialize(byte[], int, int, DocumentImpl, boolean) method of the corresponding node class. The node will be allocated in the pool and should be released once it is no longer needed.

Parameters:
data -
start -
len -
doc -

getQName

public QName getQName()
Specified by:
getQName in interface QNameable

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

setNodeId

public void setNodeId(NodeId dln)
The method setNodeId

Parameters:
dln - a NodeId value

getNodeId

public NodeId getNodeId()
The method getNodeId

Returns:
a NodeId value

getInternalAddress

public long getInternalAddress()
Get the internal storage address of this node

Returns:
The internalAddress value

setInternalAddress

public void setInternalAddress(long internalAddress)
Set the internal storage address of this node.

Parameters:
internalAddress - The new internalAddress value

isDirty

public boolean isDirty()
Returns true if the node was modified recently and nodes were inserted at the start or in the middle of its children.

Returns:
TRUE when node is 'dirty'

setDirty

public void setDirty(boolean dirty)

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface Node
See Also:
Node.getNodeType()

getOwnerDocument

public Document getOwnerDocument()
Specified by:
getOwnerDocument in interface Node
See Also:
Node.getOwnerDocument()

getDocument

public DocumentImpl getDocument()

setOwnerDocument

public void setOwnerDocument(DocumentImpl ownerDocument)
Set the owner document.

Parameters:
ownerDocument - The new ownerDocument value

getDocId

public int getDocId()

getParentNode

public Node getParentNode()
Specified by:
getParentNode in interface Node
See Also:
Node.getParentNode()

getPreviousSibling

public Node getPreviousSibling()
Specified by:
getPreviousSibling in interface Node
See Also:
Node.getPreviousSibling()

getNextSibling

public Node getNextSibling()
Specified by:
getNextSibling in interface Node
See Also:
Node.getNextSibling()

getPath

public NodePath getPath()

getPath

public NodePath getPath(NodePath parentPath)

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(boolean top)

release

public void release()
Release all memory resources hold by this node.


accept

public boolean accept(NodeVisitor visitor)

accept

public boolean accept(Iterator iterator,
                      NodeVisitor visitor)
Description copied from interface: Visitable
Visit the current node. For element nodes, the method recursively traverses through the child nodes and calls accept on each of them.

Specified by:
accept in interface Visitable
Parameters:
iterator - an iterator positioned at the current node
visitor - the visitor to call.
Returns:
the value returned by the NodeVisitor.visit method.


Copyright (C) Wolfgang Meier. All rights reserved.