|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.tinytree.TinyTree
public final class TinyTree
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 | |
---|---|
protected int[] |
alpha
|
protected int[] |
attCode
|
protected int[] |
attParent
|
protected int[] |
attTypeCode
|
protected Value[] |
attTypedValue
|
protected CharSequence[] |
attValue
|
protected int[] |
beta
|
protected LargeStringBuffer |
charBuffer
|
protected FastStringBuffer |
commentBuffer
|
protected short[] |
depth
|
protected long |
documentNumber
|
protected int[] |
nameCode
|
protected int[] |
namespaceCode
|
protected int[] |
namespaceParent
|
protected int[] |
next
|
byte[] |
nodeKind
|
protected int |
numberOfAttributes
|
protected int |
numberOfNamespaces
|
protected int |
numberOfNodes
|
protected int[] |
prior
|
protected int |
rootIndexUsed
|
protected int[] |
typeCodeArray
|
protected Value[] |
typedValueArray
|
protected boolean |
usesNamespaces
|
Constructor Summary | |
---|---|
TinyTree()
Create a TinyTree. |
|
TinyTree(int nodes,
int attributes,
int namespaces,
int characters)
Create a tree with a specified initial size |
Method Summary | |
---|---|
(package private) void |
addAttribute(NodeInfo root,
int parent,
int nameCode,
int typeCode,
CharSequence attValue,
int properties)
Add an attribute node to the tree |
(package private) int |
addDocumentNode(TinyDocumentImpl doc)
Add a document node to the tree. |
(package private) void |
addNamespace(int parent,
int nscode)
Add a namespace node to the current element |
(package private) int |
addNode(short kind,
int depth,
int alpha,
int beta,
int nameCode)
Add a node to the tree |
int |
addTextNodeCopy(int depth,
int existingNodeNr)
Create a new text node that is a copy of an existing text node |
(package private) void |
appendChars(CharSequence chars)
Append character data to the current text node |
(package private) void |
condense()
Condense the tree: release unused memory. |
void |
diagnosticDump()
Produce diagnostic print of main tree arrays |
static void |
diagnosticDump(NodeInfo node)
Create diagnostic dump of the tree containing a particular node. |
(package private) void |
ensurePriorIndex()
On demand, make an index for quick access to preceding-sibling nodes |
int[] |
getAlphaArray()
Get the array holding alpha information |
(package private) AtomicValue |
getAtomizedValueOfUntypedNode(int nodeNr)
Get the typed value of a node whose type is known to be untypedAtomic. |
(package private) int |
getAttributeAnnotation(int nr)
Get the type annotation of an attribute node. |
int[] |
getAttributeNameCodeArray()
Get the array used to hold the name codes of all attributes |
(package private) TinyAttributeImpl |
getAttributeNode(int nr)
Make a (transient) attribute node from the array of attributes |
int[] |
getAttributeParentArray()
Get the array used to hold the parent pointers of all attributes |
int[] |
getAttributeTypeCodeArray()
Get the array used to hold the type codes of all attributes |
CharSequence[] |
getAttributeValueArray()
Get the array used to hold the name codes of all attributes |
int[] |
getBetaArray()
Get the array holding beta information |
CharSequence |
getCharacterBuffer()
Get the character buffer used to hold all the text data of the document |
(package private) int |
getColumnNumber(int sequence)
Get the column number for a node. |
CharSequence |
getCommentBuffer()
Get the character buffer used to hold all the comment data of the document |
Configuration |
getConfiguration()
Get the configuration previously set using setConfiguration |
long |
getDocumentNumber()
Get the document number (actually, the tree number) |
int |
getLineNumber(int sequence)
Get the line number for a node. |
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()
Get the array holding node name information |
NamePool |
getNamePool()
Get the name pool used for the names in this document |
int[] |
getNamespaceCodeArray()
Get the array used to hold the namespace codes of namespace declarations |
int[] |
getNamespaceParentArray()
Get the array used to hold the parent pointers of all namespace declarations |
int[] |
getNextPointerArray()
Get the array holding next-sibling pointers |
TinyNodeImpl |
getNode(int nr)
Get the node at a given position in the tree |
short[] |
getNodeDepthArray()
Get the array holding node depth information |
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()
Get the array holding node kind information |
int |
getNumberOfAttributes()
Get the number of attributes in the tree |
int |
getNumberOfNamespaces()
Get the number of namespace declarations in the tree |
int |
getNumberOfNodes()
Get the number of nodes in the tree, excluding attributes and namespace nodes |
(package private) int |
getRootNode(int nodeNr)
Get the root node for a given node |
String |
getSystemId(int seq)
Get the system id of an element in the document |
int |
getTypeAnnotation(int nodeNr)
Get the type annotation of a node. |
int[] |
getTypeCodeArray()
Get the array holding node type information |
Value |
getTypedValueOfAttribute(int nodeNr)
Get the type value of an attribute node, given only the node number. |
Value |
getTypedValueOfAttribute(TinyAttributeImpl att)
Get the type value of an attribute node. |
Value |
getTypedValueOfElement(int nodeNr)
Get the type value of an element node, given only the node number |
Value |
getTypedValueOfElement(TinyElementImpl element)
Get the type value of an element node. |
void |
indexIDElement(NodeInfo root,
int nodeNr,
NameChecker checker)
Index an element of type xs:ID |
boolean |
isIdAttribute(int nr)
Determine whether an attribute is an IDREF/IDREFS attribute. |
boolean |
isIdElement(int nr)
Ask whether an element is an ID element. |
boolean |
isIdrefAttribute(int nr)
Determine whether an attribute is an IDREF/IDREFS attribute. |
boolean |
isIdrefElement(int nr)
Ask whether an element is an IDREF/IDREFS element. |
boolean |
isNilled(int nodeNr)
Ask whether a given node is nilled |
void |
setConfiguration(Configuration config)
Set the Configuration that contains this document |
(package private) void |
setElementAnnotation(int nodeNr,
int typeCode)
Set the type annotation of an element node |
(package private) void |
setLineNumber(int sequence,
int line,
int column)
Set the line number for a node. |
void |
setLineNumbering()
Set line numbering on |
(package private) void |
setSystemId(int seq,
String uri)
Set the system id of an element in the document. |
void |
showSize()
Output a statistical summary to System.err |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected long documentNumber
protected LargeStringBuffer charBuffer
protected FastStringBuffer commentBuffer
protected int numberOfNodes
public byte[] nodeKind
protected short[] depth
protected int[] next
protected int[] alpha
protected int[] beta
protected int[] nameCode
protected int[] prior
protected int[] typeCodeArray
protected Value[] typedValueArray
protected int numberOfAttributes
protected int[] attParent
protected int[] attCode
protected CharSequence[] attValue
protected Value[] attTypedValue
protected int[] attTypeCode
protected int numberOfNamespaces
protected int[] namespaceParent
protected int[] namespaceCode
protected int rootIndexUsed
protected boolean usesNamespaces
Constructor Detail |
---|
public TinyTree()
public TinyTree(int nodes, int attributes, int namespaces, int characters)
nodes
- the expected number of (non attribute or namespace) nodesattributes
- the expected number of attributesnamespaces
- the expected number of namespace declarationscharacters
- the expected number of characters in the document (in text nodes)Method Detail |
---|
public void setConfiguration(Configuration config)
config
- the Saxon configurationpublic Configuration getConfiguration()
public NamePool getNamePool()
int addDocumentNode(TinyDocumentImpl doc)
doc
- the document node to be added
int addNode(short kind, int depth, int alpha, int beta, int nameCode)
kind
- The kind of the node. This must be a document, element, text, comment,
or processing-instruction node (not an attribute or namespace)depth
- The depth in the treealpha
- Pointer to attributes or textbeta
- Pointer to namespaces or textnameCode
- The name of the node
void appendChars(CharSequence chars)
chars
- the character data to be appendedpublic int addTextNodeCopy(int depth, int existingNodeNr)
depth
- the depth of the new nodeexistingNodeNr
- the node to be copied
void condense()
void setElementAnnotation(int nodeNr, int typeCode)
nodeNr
- the node whose type annotation is to be settypeCode
- the type annotationpublic int getTypeAnnotation(int nodeNr)
nodeNr
- the node whose type annotation is required
public Value getTypedValueOfElement(TinyElementImpl element) throws XPathException
element
- the element node
XPathException
public Value getTypedValueOfElement(int nodeNr) throws XPathException
nodeNr
- the node number of the element node
XPathException
public Value getTypedValueOfAttribute(TinyAttributeImpl att) throws XPathException
att
- the attribute node
XPathException
public Value getTypedValueOfAttribute(int nodeNr) throws XPathException
nodeNr
- the node number of the attribute node
XPathException
public int getNodeKind(int nodeNr)
nodeNr
- the node number
public int getNameCode(int nodeNr)
nodeNr
- the node number
void ensurePriorIndex()
void addAttribute(NodeInfo root, int parent, int nameCode, int typeCode, CharSequence attValue, int properties)
root
- the root of the tree to contain the attributeparent
- the parent element of the new attributenameCode
- the name code of the attributetypeCode
- the type annotation of the attributeattValue
- the string value of the attributeproperties
- any special properties of the attribute (bit-significant)public void indexIDElement(NodeInfo root, int nodeNr, NameChecker checker)
root
- the root node of the documentnodeNr
- the element of type xs:IDchecker
- checks names against XML 1.0 or XML 1.1 rulesvoid addNamespace(int parent, int nscode)
parent
- the node number of the elementnscode
- namespace code identifying the prefix and uripublic final TinyNodeImpl getNode(int nr)
nr
- the node number
AtomicValue getAtomizedValueOfUntypedNode(int nodeNr)
nodeNr
- the node whose typed value is required
TinyAttributeImpl getAttributeNode(int nr)
nr
- the node number of the attribute
int getAttributeAnnotation(int nr)
NodeInfo.IS_DTD_TYPE
(1<<30) will be set in the case of an attribute node if the type annotation
is one of ID, IDREF, or IDREFS and this is derived from DTD rather than schema validation.
nr
- the node number of the attribute
public boolean isIdAttribute(int nr)
nr
- the node number of the attribute
public boolean isIdrefAttribute(int nr)
nr
- the node number of the attribute
public boolean isIdElement(int nr)
nr
- the element node whose is-idref property is required
public boolean isIdrefElement(int nr)
nr
- the element node whose is-idref property is required
void setSystemId(int seq, String uri)
seq
- the node numberuri
- the system IDpublic String getSystemId(int seq)
seq
- the node number of the element node
int getRootNode(int nodeNr)
nodeNr
- the node number of the given node
public void setLineNumbering()
void setLineNumber(int sequence, int line, int column)
sequence
- the node numberline
- the line number to be set for the nodecolumn
- the column number for the nodepublic int getLineNumber(int sequence)
sequence
- the node number
int getColumnNumber(int sequence)
sequence
- the node number
public long getDocumentNumber()
public boolean isNilled(int nodeNr)
nodeNr
- the node in question (which must be an element node)
public void diagnosticDump()
public static void diagnosticDump(NodeInfo node)
node
- the node in questionpublic void showSize()
public int getNumberOfNodes()
public int getNumberOfAttributes()
public int getNumberOfNamespaces()
public byte[] getNodeKindArray()
public short[] getNodeDepthArray()
public int[] getNameCodeArray()
public int[] getTypeCodeArray()
public int[] getNextPointerArray()
public int[] getAlphaArray()
public int[] getBetaArray()
public CharSequence getCharacterBuffer()
public CharSequence getCommentBuffer()
public int[] getAttributeNameCodeArray()
public int[] getAttributeTypeCodeArray()
public int[] getAttributeParentArray()
public CharSequence[] getAttributeValueArray()
public int[] getNamespaceCodeArray()
public int[] getNamespaceParentArray()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |