org.exist.dom
Class NodeProxy

java.lang.Object
  extended byorg.exist.dom.NodeProxy
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable

public final class NodeProxy
extends java.lang.Object
implements java.lang.Comparable, java.lang.Cloneable

Placeholder class for any DOM-node. NodeProxy stores a node's unique id and the document a node belongs to. eXist will always try to use a NodeProxy instead of the actual node. Using a NodeProxy is much cheaper than loading the actual node from the database. All sets of type NodeSet operate on NodeProxys. NodeProxy implements Comparable, which is needed by all node-sets. To convert a NodeProxy to a real node, simply call getNode().

Author:
Wolfgang Meier

Nested Class Summary
static class NodeProxy.NodeProxyComparator
           
 
Field Summary
 LongLinkedList contextNodes
           
 DocumentImpl doc
           
 long gid
           
 long internalAddress
           
 Match[] matches
           
 short nodeType
           
 
Constructor Summary
NodeProxy()
           
NodeProxy(DocumentImpl doc, long gid)
          Construct a node proxy with unique id gid and owned by document doc.
NodeProxy(DocumentImpl doc, long gid, long address)
          Constructor for the NodeProxy object
NodeProxy(DocumentImpl doc, long gid, short nodeType)
          as above, but a hint is given about the node type of this proxy-object.
NodeProxy(DocumentImpl doc, long gid, short nodeType, long address)
          Constructor for the NodeProxy object
NodeProxy(NodeImpl node)
          Constructor for the NodeProxy object
NodeProxy(NodeProxy p)
          Constructor for the NodeProxy object
 
Method Summary
 void addContextNode(NodeProxy node)
           
 void addMatch(Match match)
           
 void addMatches(Match[] m)
           
 void clear()
          Reset the object's state (for reuse).
 java.lang.Object clone()
           
 int compareTo(java.lang.Object other)
           
 void copyContext(NodeProxy node)
           
 boolean equals(java.lang.Object other)
           
 int getBrokerType()
          Gets the brokerType attribute of the NodeProxy object
 LongLinkedList getContext()
           
 DocumentImpl getDoc()
          Gets the doc attribute of the NodeProxy object
 long getGID()
          Gets the gID attribute of the NodeProxy object
 long getInternalAddress()
          Returns the storage address of this node in dom.dbx.
 org.w3c.dom.Node getNode()
          Gets the node attribute of the NodeProxy object
 short getNodeType()
          Gets the nodeType attribute of the NodeProxy object
 java.lang.String getNodeValue()
          Gets the nodeValue attribute of the NodeProxy object
 boolean hasIndex()
           
 boolean hasMatch(Match match)
           
 java.lang.String printMatches()
           
 void setDoc(DocumentImpl doc)
          Sets the doc this node belongs to.
 void setGID(long gid)
          Sets the node-identifier of this node.
 void setHasIndex(boolean hasIndex)
           
 void setInternalAddress(long internalAddress)
          Sets the storage address of this node in dom.dbx.
 void setNodeType(short nodeType)
          Sets the nodeType.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

doc

public DocumentImpl doc

gid

public long gid

internalAddress

public long internalAddress

contextNodes

public LongLinkedList contextNodes

nodeType

public short nodeType

matches

public Match[] matches
Constructor Detail

NodeProxy

public NodeProxy()

NodeProxy

public NodeProxy(DocumentImpl doc,
                 long gid,
                 long address)
Constructor for the NodeProxy object

Parameters:
doc - Description of the Parameter
gid - Description of the Parameter
address - Description of the Parameter

NodeProxy

public NodeProxy(DocumentImpl doc,
                 long gid)
Construct a node proxy with unique id gid and owned by document doc.

Parameters:
doc - Description of the Parameter
gid - Description of the Parameter

NodeProxy

public NodeProxy(DocumentImpl doc,
                 long gid,
                 short nodeType)
as above, but a hint is given about the node type of this proxy-object.

Parameters:
doc - Description of the Parameter
gid - Description of the Parameter
nodeType - Description of the Parameter

NodeProxy

public NodeProxy(DocumentImpl doc,
                 long gid,
                 short nodeType,
                 long address)
Constructor for the NodeProxy object

Parameters:
doc - Description of the Parameter
gid - Description of the Parameter
nodeType - Description of the Parameter
address - Description of the Parameter

NodeProxy

public NodeProxy(NodeProxy p)
Constructor for the NodeProxy object

Parameters:
p - Description of the Parameter

NodeProxy

public NodeProxy(NodeImpl node)
Constructor for the NodeProxy object

Parameters:
node - Description of the Parameter
Method Detail

clear

public void clear()
Reset the object's state (for reuse).


compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object other)

getBrokerType

public int getBrokerType()
Gets the brokerType attribute of the NodeProxy object

Returns:
The brokerType value

getDoc

public DocumentImpl getDoc()
Gets the doc attribute of the NodeProxy object

Returns:
The doc value

getGID

public long getGID()
Gets the gID attribute of the NodeProxy object

Returns:
The gID value

getNode

public org.w3c.dom.Node getNode()
Gets the node attribute of the NodeProxy object

Returns:
The node value

getNodeType

public short getNodeType()
Gets the nodeType attribute of the NodeProxy object

Returns:
The nodeType value

getNodeValue

public java.lang.String getNodeValue()
Gets the nodeValue attribute of the NodeProxy object

Returns:
The nodeValue value

setGID

public void setGID(long gid)
Sets the node-identifier of this node.

Parameters:
gid - The new gID value

toString

public java.lang.String toString()

getInternalAddress

public long getInternalAddress()
Returns the storage address of this node in dom.dbx.

Returns:
long

setDoc

public void setDoc(DocumentImpl doc)
Sets the doc this node belongs to.

Parameters:
doc - The doc to set

setInternalAddress

public void setInternalAddress(long internalAddress)
Sets the storage address of this node in dom.dbx.

Parameters:
internalAddress - The internalAddress to set

setHasIndex

public void setHasIndex(boolean hasIndex)

hasIndex

public boolean hasIndex()

setNodeType

public void setNodeType(short nodeType)
Sets the nodeType.

Parameters:
nodeType - The nodeType to set

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

hasMatch

public boolean hasMatch(Match match)

addMatch

public void addMatch(Match match)

addMatches

public void addMatches(Match[] m)

printMatches

public java.lang.String printMatches()

addContextNode

public void addContextNode(NodeProxy node)

copyContext

public void copyContext(NodeProxy node)

getContext

public LongLinkedList getContext()


Copyright (C) Wolfgang Meier. All rights reserved.