net.sf.saxon.tinytree
Class TinyTree

java.lang.Object
  extended by net.sf.saxon.tinytree.TinyTree

public final class TinyTree
extends Object

A data structure to hold the contents of a tree. As the name implies, this implementation of the data model is optimized for size, and for speed of creation: it minimizes the number of Java objects used.

It can be used to represent a tree that is rooted at a document node, or one that is rooted at an element node.


Field Summary
 byte[] nodeKind
           
 
Constructor Summary
TinyTree()
           
TinyTree(int nodes, int attributes, int namespaces, int characters)
           
 
Method Summary
 void diagnosticDump()
          Produce diagnostic print of main tree arrays
static void diagnosticDump(NodeInfo node)
          Create diagnostic dump of the tree containing a particular node.
 int[] getAlphaArray()
           
 int[] getAttributeNameCodeArray()
           
 int[] getAttributeParentArray()
           
 int[] getAttributeTypeCodeArray()
           
 CharSequence[] getAttributeValueArray()
           
 int[] getBetaArray()
           
 CharSequence getCharacterBuffer()
           
 CharSequence getCommentBuffer()
           
 Configuration getConfiguration()
          Get the configuration previously set using setConfiguration
 int getDocumentNumber()
          Get the document number (actually, the tree number)
 int getNameCode(int nodeNr)
          Get the nameCode for a given node, which must be a document, element, text, comment, or processing instruction node
 int[] getNameCodeArray()
           
 NamePool getNamePool()
          Get the name pool used for the names in this document
 int[] getNamespaceCodeArray()
           
 int[] getNamespaceParentArray()
           
 int[] getNextPointerArray()
           
 TinyNodeImpl getNode(int nr)
           
 short[] getNodeDepthArray()
           
 int getNodeKind(int nodeNr)
          Get the node kind of a given node, which must be a document, element, text, comment, or processing instruction node
 byte[] getNodeKindArray()
           
 int getNumberOfAttributes()
           
 int getNumberOfNamespaces()
           
 int getNumberOfNodes()
          Get the number of nodes in the tree, excluding attributes and namespace nodes
 int getTypeAnnotation(int nodeNr)
          Get the type annotation of a node.
 int[] getTypeCodeArray()
           
 void indexIDElement(NodeInfo root, int nodeNr, NameChecker checker)
          Index an element of type xs:ID
 boolean isIdrefAttribute(int nr)
          Determine whether an attribute is an IDREF/IDREFS attribute.
 boolean isIdrefElement(int nr)
          Determine whether an element is an IDREF/IDREFS element.
 boolean isNilled(int nodeNr)
          Determine whether a given node is nilled
 void setConfiguration(Configuration config)
          Set the Configuration that contains this document
 void setLineNumbering()
          Set line numbering on
 void showSize()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeKind

public byte[] nodeKind
Constructor Detail

TinyTree

public TinyTree()

TinyTree

public TinyTree(int nodes,
                int attributes,
                int namespaces,
                int characters)
Method Detail

setConfiguration

public void setConfiguration(Configuration config)
Set the Configuration that contains this document


getConfiguration

public Configuration getConfiguration()
Get the configuration previously set using setConfiguration


getNamePool

public NamePool getNamePool()
Get the name pool used for the names in this document


getTypeAnnotation

public int getTypeAnnotation(int nodeNr)
Get the type annotation of a node. Applies only to document, element, text, processing instruction, and comment nodes.

Returns:
the fingerprint of the type annotation for elements and attributes, otherwise undefined.

getNodeKind

public int getNodeKind(int nodeNr)
Get the node kind of a given node, which must be a document, element, text, comment, or processing instruction node

Parameters:
nodeNr - the node number
Returns:
the node kind

getNameCode

public int getNameCode(int nodeNr)
Get the nameCode for a given node, which must be a document, element, text, comment, or processing instruction node

Parameters:
nodeNr - the node number
Returns:
the name code

indexIDElement

public void indexIDElement(NodeInfo root,
                           int nodeNr,
                           NameChecker checker)
Index an element of type xs:ID


getNode

public final TinyNodeImpl getNode(int nr)

isIdrefAttribute

public boolean isIdrefAttribute(int nr)
Determine whether an attribute is an IDREF/IDREFS attribute. (The represents the is-idref property in the data model)


isIdrefElement

public boolean isIdrefElement(int nr)
Determine whether an element is an IDREF/IDREFS element. (The represents the is-idref property in the data model)


setLineNumbering

public void setLineNumbering()
Set line numbering on


getDocumentNumber

public int getDocumentNumber()
Get the document number (actually, the tree number)


isNilled

public boolean isNilled(int nodeNr)
Determine whether a given node is nilled


diagnosticDump

public void diagnosticDump()
Produce diagnostic print of main tree arrays


diagnosticDump

public static void diagnosticDump(NodeInfo node)
Create diagnostic dump of the tree containing a particular node. Designed to be called as an extension function for diagnostics.


showSize

public void showSize()

getNumberOfNodes

public int getNumberOfNodes()
Get the number of nodes in the tree, excluding attributes and namespace nodes

Returns:
the number of nodes.

getNumberOfAttributes

public int getNumberOfAttributes()

getNumberOfNamespaces

public int getNumberOfNamespaces()

getNodeKindArray

public byte[] getNodeKindArray()

getNodeDepthArray

public short[] getNodeDepthArray()

getNameCodeArray

public int[] getNameCodeArray()

getTypeCodeArray

public int[] getTypeCodeArray()

getNextPointerArray

public int[] getNextPointerArray()

getAlphaArray

public int[] getAlphaArray()

getBetaArray

public int[] getBetaArray()

getCharacterBuffer

public CharSequence getCharacterBuffer()

getCommentBuffer

public CharSequence getCommentBuffer()

getAttributeNameCodeArray

public int[] getAttributeNameCodeArray()

getAttributeTypeCodeArray

public int[] getAttributeTypeCodeArray()

getAttributeParentArray

public int[] getAttributeParentArray()

getAttributeValueArray

public CharSequence[] getAttributeValueArray()

getNamespaceCodeArray

public int[] getNamespaceCodeArray()

getNamespaceParentArray

public int[] getNamespaceParentArray()


Copyright (C) Michael H. Kay. All rights reserved.