org.cdlib.xtf.lazyTree
Class SearchElementImpl

Object
  extended by NodeImpl
      extended by ParentNodeImpl
          extended by ElementImpl
              extended by SearchElementImpl
All Implemented Interfaces:
Source, SourceLocator, FingerprintedNode, Item, NodeInfo, ValueRepresentation, SearchElement, SearchNode

public class SearchElementImpl
extends ElementImpl
implements SearchElement

Represents an element that has been (possibly) modified to reflect search results. Handles adding the <xtf:hitCount> attribute so the client can easily show how many hits a given section has within it.

Author:
Martin Haye

Field Summary
(package private)  boolean specialAttrChecked
           
 
Fields inherited from class ElementImpl
attrNames, attrValues, nameSpace
 
Fields inherited from class ParentNodeImpl
childNum
 
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
SearchElementImpl(SearchTree tree)
           
 
Method Summary
private  void addSpecialAttrib()
           
 void allocateAttributes(int nAttrs)
          Allocate the attribute array.
 void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
          Copy this node to a given receiver
 String getAttributeValue(int fingerprint)
          Get the value of a given attribute of this node
protected  long getSequenceNumber()
          Gets the sequence number of this element, used for sorting nodes in document order.
 AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest)
          Return an enumeration over the nodes reached by the given axis from this node
 void sendNamespaceDeclarations(Receiver out, boolean includeAncestors)
          Output all namespace nodes associated with this element.
 void setAttribute(int attrNum, int nameCode, String value)
          Set an attribute
 void setChildNum(int num)
          Establish the child node number
 void setNameCode(int code)
          Establish a name for this node
 void setNextSibNum(int num)
          Establish the next sibling node number
 void setNodeNum(int nodeNum)
          Set the node number for this node.
 void setParentNum(int parentNum)
          Establish the parent node
 void setPrevSibNum(int num)
          Establish the previous sibling node number
 
Methods inherited from class ElementImpl
getBaseURI, getDeclaredNamespaces, getDeclaredNamespaces, getNodeKind, getTypeAnnotation, init
 
Methods inherited from class ParentNodeImpl
enumerateChildren, getFirstChild, getLastChild, getStringValue, getStringValueCS, hasChildNodes, iterateAxis
 
Methods inherited from class NodeImpl
atomize, compareOrder, equals, generateId, getColumnNumber, getConfiguration, getDisplayName, getDocumentNumber, getDocumentRoot, getFingerprint, getLineNumber, getLocalPart, getNameCode, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getRoot, getSystemId, getTypedValue, getURI, hashCode, isSameNodeInfo, setSystemId
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

specialAttrChecked

boolean specialAttrChecked
Constructor Detail

SearchElementImpl

SearchElementImpl(SearchTree tree)
Method Detail

setNodeNum

public void setNodeNum(int nodeNum)
Set the node number for this node.

Specified by:
setNodeNum in interface SearchNode

allocateAttributes

public void allocateAttributes(int nAttrs)
Allocate the attribute array.

Specified by:
allocateAttributes in interface SearchElement

setAttribute

public void setAttribute(int attrNum,
                         int nameCode,
                         String value)
Set an attribute

Specified by:
setAttribute in interface SearchElement

setParentNum

public void setParentNum(int parentNum)
Establish the parent node

Specified by:
setParentNum in interface SearchNode

setChildNum

public void setChildNum(int num)
Establish the child node number

Specified by:
setChildNum in interface SearchElement

setNextSibNum

public void setNextSibNum(int num)
Establish the next sibling node number

Specified by:
setNextSibNum in interface SearchNode

setPrevSibNum

public void setPrevSibNum(int num)
Establish the previous sibling node number

Specified by:
setPrevSibNum in interface SearchNode

setNameCode

public void setNameCode(int code)
Establish a name for this node

Specified by:
setNameCode in interface SearchElement

iterateAxis

public AxisIterator iterateAxis(byte axisNumber,
                                NodeTest nodeTest)
Return an enumeration over the nodes reached by the given axis from this node

Specified by:
iterateAxis in interface NodeInfo
Overrides:
iterateAxis in class ParentNodeImpl
Parameters:
axisNumber - The axis to be iterated over
nodeTest - A pattern to be matched by the returned nodes
Returns:
an AxisIterator that scans the nodes reached by the axis in turn.

getAttributeValue

public String getAttributeValue(int fingerprint)
Get the value of a given attribute of this node

Specified by:
getAttributeValue in interface NodeInfo
Overrides:
getAttributeValue in class ElementImpl
Parameters:
fingerprint - The fingerprint of the attribute name
Returns:
the attribute value if it exists or null if not

copy

public void copy(Receiver out,
                 int whichNamespaces,
                 boolean copyAnnotations,
                 int locationId)
          throws XPathException
Description copied from class: ElementImpl
Copy this node to a given receiver

Specified by:
copy in interface NodeInfo
Overrides:
copy in class ElementImpl
whichNamespaces - indicates which namespaces should be copied: all, none, or local (i.e., those not declared on a parent element)
Throws:
XPathException

addSpecialAttrib

private void addSpecialAttrib()

getSequenceNumber

protected long getSequenceNumber()
Gets the sequence number of this element, used for sorting nodes in document order.

Overrides:
getSequenceNumber in class NodeImpl

sendNamespaceDeclarations

public void sendNamespaceDeclarations(Receiver out,
                                      boolean includeAncestors)
                               throws XPathException
Output all namespace nodes associated with this element.

Specified by:
sendNamespaceDeclarations in interface NodeInfo
Overrides:
sendNamespaceDeclarations in class ElementImpl
Parameters:
out - The relevant outputter
includeAncestors - True if namespaces associated with ancestor
Throws:
XPathException