org.cdlib.xtf.lazyTree
Class ProxyAttributeImpl

Object
  extended by NodeImpl
      extended by ProxyAttributeImpl
All Implemented Interfaces:
Source, SourceLocator, FingerprintedNode, Item, NodeInfo, ValueRepresentation

 class ProxyAttributeImpl
extends NodeImpl

Represents an attribute node from a persistent XML document. Used by ProxyElement to implement lazy attribute loading.

Author:
Martin Haye

Field Summary
(package private)  ProxyElement element
           
(package private)  int index
           
 
Fields inherited from class NodeImpl
document, nameCode, nextSibNum, NODE_LETTER, nodeNum, parentNum, prevSibNum
 
Fields inherited from interface NodeInfo
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
 
Fields inherited from interface ValueRepresentation
EMPTY_VALUE_ARRAY
 
Constructor Summary
ProxyAttributeImpl(ProxyElement element, int index)
          Construct an Attribute node for the n'th attribute of a given element
 
Method Summary
 void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
          Copy this node to a given outputter
 void generateId(FastStringBuffer buffer)
          Get sequential key.
 String getDisplayName()
          Obtain the displayable name of this attribute.
 DocumentInfo getDocumentRoot()
          Get the root (document) node
 int getNameCode()
          Get the name code, which enables the name to be located in the name pool
 NamePool getNamePool()
          Get the NamePool for the tree containing this node
 NodeInfo getNextSibling()
          Get next sibling - not defined for attributes
 int getNodeKind()
          Return the type of node.
 NodeImpl getPreviousInDocument()
          Get the previous node in document order (skipping attributes)
 NodeInfo getPreviousSibling()
          Get previous sibling - not defined for attributes
 NodeInfo getRoot()
          Get the root node of the tree (not necessarily a document node)
protected  long getSequenceNumber()
          Get the node sequence number (in document order).
 String getStringValue()
          Return the character value of the node.
 boolean isSameNodeInfo(NodeInfo other)
          Determine whether this is the same node as another node
 
Methods inherited from class NodeImpl
atomize, compareOrder, equals, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDocumentNumber, getFingerprint, getFirstChild, getLastChild, getLineNumber, getLocalPart, getNextInDocument, getParent, getPrefix, getPublicId, getStringValueCS, getSystemId, getTypeAnnotation, getTypedValue, getURI, hasChildNodes, hashCode, init, iterateAxis, iterateAxis, sendNamespaceDeclarations, setSystemId
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

ProxyElement element

index

int index
Constructor Detail

ProxyAttributeImpl

public ProxyAttributeImpl(ProxyElement element,
                          int index)
Construct an Attribute node for the n'th attribute of a given element

Parameters:
element - The element containing the relevant attribute
index - The index position of the attribute starting at zero
Method Detail

getNameCode

public int getNameCode()
Get the name code, which enables the name to be located in the name pool

Specified by:
getNameCode in interface NodeInfo
Overrides:
getNameCode in class NodeImpl

getRoot

public NodeInfo getRoot()
Get the root node of the tree (not necessarily a document node)

Specified by:
getRoot in interface NodeInfo
Overrides:
getRoot in class NodeImpl
Returns:
the NodeInfo representing the root of this tree

getDocumentRoot

public DocumentInfo getDocumentRoot()
Get the root (document) node

Specified by:
getDocumentRoot in interface NodeInfo
Overrides:
getDocumentRoot in class NodeImpl
Returns:
the DocumentInfo representing the containing document

getNamePool

public NamePool getNamePool()
Get the NamePool for the tree containing this node

Specified by:
getNamePool in interface NodeInfo
Overrides:
getNamePool in class NodeImpl
Returns:
the NamePool

isSameNodeInfo

public boolean isSameNodeInfo(NodeInfo other)
Determine whether this is the same node as another node

Specified by:
isSameNodeInfo in interface NodeInfo
Overrides:
isSameNodeInfo in class NodeImpl
Returns:
true if this Node object and the supplied Node object represent the same node in the tree.

getSequenceNumber

protected long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In the current implementation, parent nodes (elements and roots) have a zero least-significant word, while namespaces, attributes, text nodes, comments, and PIs have the top word the same as their owner and the bottom half reflecting their relative position.

Overrides:
getSequenceNumber in class NodeImpl

getNodeKind

public final int getNodeKind()
Return the type of node.

Returns:
Node.ATTRIBUTE

getStringValue

public String getStringValue()
Return the character value of the node.

Returns:
the attribute value

getNextSibling

public NodeInfo getNextSibling()
Get next sibling - not defined for attributes

Overrides:
getNextSibling in class NodeImpl
Returns:
The next sibling node of the required type. Returns null if the current node is the last child of its parent.

getPreviousSibling

public NodeInfo getPreviousSibling()
Get previous sibling - not defined for attributes

Overrides:
getPreviousSibling in class NodeImpl
Returns:
The previous sibling node. Returns null if the current node is the first child of its parent.

getPreviousInDocument

public NodeImpl getPreviousInDocument()
Get the previous node in document order (skipping attributes)

Overrides:
getPreviousInDocument in class NodeImpl
Returns:
the previous node in the document, or null if there is no such node

generateId

public void generateId(FastStringBuffer buffer)
Get sequential key. Returns key of owning element with the attribute name as a suffix

Specified by:
generateId in interface NodeInfo
Overrides:
generateId in class NodeImpl

getDisplayName

public String getDisplayName()
Obtain the displayable name of this attribute.

Specified by:
getDisplayName in interface NodeInfo
Overrides:
getDisplayName in class NodeImpl
Returns:
The display name of this node. For a node with no name, return an empty string.

copy

public void copy(Receiver out,
                 int whichNamespaces,
                 boolean copyAnnotations,
                 int locationId)
          throws XPathException
Copy this node to a given outputter

Throws:
XPathException