public final class TinyTree extends GenericTreeInfo implements NodeVectorTree
It can be used to represent a tree that is rooted at a document node, or one that is rooted at an element node.
From Saxon 9.7, as a consequence of bug 2220, it is used only to hold a single tree, whose root is always node number zero.
Modifier and Type | Field and Description |
---|---|
protected int[] |
alpha |
protected int[] |
attCode |
protected int[] |
attParent |
protected SimpleType[] |
attType |
protected AtomicSequence[] |
attTypedValue |
protected java.lang.CharSequence[] |
attValue |
protected int[] |
beta |
protected AppendableCharSequence |
charBuffer |
protected FastStringBuffer |
commentBuffer |
protected IntSet |
defaultedAttributes |
protected short[] |
depth |
protected java.util.HashMap<java.lang.String,java.lang.String[]> |
entityTable |
protected java.util.List<GraftedElement> |
externalNodes |
protected IntSet |
idRefAttributes |
protected IntSet |
idRefElements |
protected IntHashMap<java.lang.String> |
knownBaseUris |
protected int[] |
nameCode |
protected NamespaceBinding[] |
namespaceBinding |
protected int[] |
namespaceParent |
protected int[] |
next |
protected IntSet |
nilledElements |
byte[] |
nodeKind |
protected int |
numberOfAttributes |
protected int |
numberOfNamespaces |
protected int |
numberOfNodes |
protected PrefixPool |
prefixPool |
protected int[] |
prior |
protected IntSet |
topWithinEntity |
protected SchemaType[] |
typeArray |
static int |
TYPECODE_IDREF |
protected AtomicSequence[] |
typedValueArray |
static boolean |
useBulkCopy
Temporary flag introduced in Saxon 9.8.0.5 to enable or disable fast-path code for copying
element nodes from one TinyTree to another.
|
static boolean |
useGraft |
protected boolean |
usesNamespaces |
root
Constructor and Description |
---|
TinyTree(Configuration config,
Statistics statistics)
Create a tree with a specified initial size
|
Modifier and Type | Method and Description |
---|---|
int |
addTextNodeCopy(int depth,
int existingNodeNr)
Create a new text node that is a copy of an existing text node
|
void |
bulkCopy(TinyTree source,
int nodeNr,
int[] prevAtDepth,
int currentDepth)
Bulk copy an element node from another TinyTree.
|
boolean |
containsGraftedSubtrees()
Ask if the tree contains grafted subtrees
|
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()
Get the array holding alpha information
|
int[] |
getAttributeNameCodeArray()
Get the array used to hold the name codes of all attributes
|
int[] |
getAttributeParentArray()
Get the array used to hold the parent pointers of all attributes
|
SimpleType[] |
getAttributeTypeArray()
Get the array used to hold the type codes of all attributes
|
java.lang.CharSequence[] |
getAttributeValueArray()
Get the array used to hold the name codes of all attributes
|
int[] |
getBetaArray()
Get the array holding beta information
|
AppendableCharSequence |
getCharacterBuffer()
Get the character buffer used to hold all the text data of the document
|
int |
getColumnNumber(int sequence)
Get the column number for a node.
|
java.lang.CharSequence |
getCommentBuffer()
Get the character buffer used to hold all the comment data of the document
|
NodeInfo |
getCopiedFrom()
Declare that this tree was produced as a copy of another tree, and identify
the root node of that tree
|
int |
getFingerprint(int nodeNr)
Get the fingerprint for a given node, which must be a document, element,
text, comment, or processing instruction node
|
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() |
NamespaceBinding[] |
getNamespaceBindings()
Get the array used to hold the 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
|
java.lang.String |
getPrefix(int nodeNr)
Get the prefix for a given element node
|
PrefixPool |
getPrefixPool()
Get the prefix pool
|
NodeInfo |
getRootNode()
Get the NodeInfo object representing the root of the tree (not necessarily a document node)
|
SchemaType |
getSchemaType(int nodeNr)
Get the type annotation of a node.
|
java.lang.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.
|
SchemaType[] |
getTypeArray()
Get the array holding node type information
|
AtomicSequence |
getTypedValueOfAttribute(TinyAttributeImpl att,
int nodeNr)
Get the typed value of an attribute node.
|
AtomicSequence |
getTypedValueOfElement(int nodeNr)
Get the type value of an element node, given only the node number
|
AtomicSequence |
getTypedValueOfElement(TinyElementImpl element)
Get the typed value of an element node.
|
java.lang.String[] |
getUnparsedEntity(java.lang.String name)
Get the unparsed entity with a given nameID if there is one, or null if not.
|
java.util.Iterator<java.lang.String> |
getUnparsedEntityNames()
Get the list of unparsed entities defined in this document
|
void |
graft(NodeInfo externalNode,
int nodeNr,
int depth,
boolean copyNamespaces)
Graft an element node from an external tree
|
boolean |
hasXmlSpacePreserveAttribute()
Ask whether, somewhere in the tree, there is an attribute xml:space="preserve"
|
void |
indexIDElement(NodeInfo root,
int nodeNr)
Index an element of type xs:ID
|
boolean |
isDefaultedAttribute(int attNr)
Ask whether an attribute results from expansion of attribute defaults
|
boolean |
isIdAttribute(int nr)
Determine whether an attribute is an ID 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
|
boolean |
isTopWithinEntity(int nodeNr) |
boolean |
isTyped()
Ask whether the document contains any nodes whose type annotation is anything other than
UNTYPED
|
boolean |
isUsesNamespaces()
Ask whether the tree contains any namespace declarations
|
void |
markDefaultedAttribute(int attNr)
Mark an attribute as resulting from expansion of attribute defaults
|
void |
markTopWithinEntity(int nodeNr) |
NodeInfo |
selectID(java.lang.String id,
boolean getParent)
Get the element with a given ID.
|
void |
setConfiguration(Configuration config)
Set the Configuration that contains this document
|
void |
setCopiedFrom(NodeInfo copiedFrom)
Declare that this tree was produced as a copy of another tree, and identify
the root node of that tree
|
void |
setLineNumbering()
Set line numbering on
|
void |
setNilled(int nodeNr)
Set an element node to be marked as nilled
|
void |
showSize()
Output a statistical summary to System.err
|
getConfiguration, getDocumentNumber, getPublicId, getSpaceStrippingRule, getSystemId, getUserData, isStreamed, setDocumentNumber, setRootNode, setSpaceStrippingRule, setSystemId, setUserData
protected AppendableCharSequence 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 SchemaType[] typeArray
protected AtomicSequence[] typedValueArray
protected IntSet idRefElements
protected IntSet idRefAttributes
protected IntSet nilledElements
protected IntSet defaultedAttributes
protected IntSet topWithinEntity
public static final int TYPECODE_IDREF
protected int numberOfAttributes
protected int[] attParent
protected int[] attCode
protected java.lang.CharSequence[] attValue
protected AtomicSequence[] attTypedValue
protected SimpleType[] attType
protected int numberOfNamespaces
protected int[] namespaceParent
protected NamespaceBinding[] namespaceBinding
protected boolean usesNamespaces
protected PrefixPool prefixPool
protected java.util.HashMap<java.lang.String,java.lang.String[]> entityTable
protected java.util.List<GraftedElement> externalNodes
protected IntHashMap<java.lang.String> knownBaseUris
public static final boolean useBulkCopy
public static boolean useGraft
public TinyTree(Configuration config, Statistics statistics)
config
- the Saxon configurationstatistics
- the size parameters for the treepublic void setConfiguration(Configuration config)
setConfiguration
in class GenericTreeInfo
config
- the Saxon configurationpublic PrefixPool getPrefixPool()
public void setCopiedFrom(NodeInfo copiedFrom)
copiedFrom
- the root of the tree from which this one was copiedpublic NodeInfo getCopiedFrom()
public int addTextNodeCopy(int depth, int existingNodeNr)
depth
- the depth of the new nodeexistingNodeNr
- the node to be copiedpublic int getTypeAnnotation(int nodeNr)
nodeNr
- the node whose type annotation is requiredpublic SchemaType getSchemaType(int nodeNr)
nodeNr
- the node whose type annotation is requiredpublic AtomicSequence getTypedValueOfElement(TinyElementImpl element) throws XPathException
element
- the element nodeXPathException
- if a dynamic error occurs, for example if the node is
an element annotated with a type that has element-only contentpublic AtomicSequence getTypedValueOfElement(int nodeNr) throws XPathException
nodeNr
- the node number of the element nodeXPathException
- if the eement has no typed valuepublic AtomicSequence getTypedValueOfAttribute(TinyAttributeImpl att, int nodeNr) throws XPathException
att
- the attribute node if available. If null is supplied, the attribute node
will be materialized only if it is needed.nodeNr
- the node number of the attribute nodeXPathException
- if an error is foundpublic int getNodeKind(int nodeNr)
getNodeKind
in interface NodeVectorTree
nodeNr
- the node numberpublic int getNameCode(int nodeNr)
nodeNr
- the node numberpublic int getFingerprint(int nodeNr)
getFingerprint
in interface NodeVectorTree
nodeNr
- the node numberpublic java.lang.String getPrefix(int nodeNr)
nodeNr
- the node numberpublic void markDefaultedAttribute(int attNr)
attNr
- the attribute numberpublic boolean isDefaultedAttribute(int attNr)
attNr
- the attribute numberFeatureKeys.EXPAND_ATTRIBUTE_DEFAULTS
and FeatureKeys.MARK_DEFAULTED_ATTRIBUTES
are set.public void indexIDElement(NodeInfo root, int nodeNr)
root
- the root node of the documentnodeNr
- the element of type xs:IDpublic boolean hasXmlSpacePreserveAttribute()
public final TinyNodeImpl getNode(int nr)
getNode
in interface NodeVectorTree
nr
- the node numberpublic boolean isIdAttribute(int nr)
nr
- the node number of the attributepublic boolean isIdrefAttribute(int nr)
nr
- the node number of the attributepublic boolean isIdElement(int nr)
nr
- the element node whose is-id property is requiredpublic boolean isIdrefElement(int nr)
nr
- the element node whose is-idref property is requiredpublic java.lang.String getSystemId(int seq)
seq
- the node number of the element nodepublic NodeInfo getRootNode()
GenericTreeInfo
getRootNode
in interface TreeInfo
getRootNode
in class GenericTreeInfo
public void setLineNumbering()
public int getLineNumber(int sequence)
sequence
- the node numberpublic int getColumnNumber(int sequence)
sequence
- the node numberpublic void setNilled(int nodeNr)
nodeNr
- the node number to be marked as nilledpublic boolean isNilled(int nodeNr)
nodeNr
- the node in question (which must be an element node)public NodeInfo selectID(java.lang.String id, boolean getParent)
selectID
in interface TreeInfo
selectID
in class GenericTreeInfo
id
- The unique ID of the required element, previously registered using registerID()getParent
- true if the required element is the parent of the element of type IDpublic java.util.Iterator<java.lang.String> getUnparsedEntityNames()
getUnparsedEntityNames
in interface TreeInfo
getUnparsedEntityNames
in class GenericTreeInfo
public java.lang.String[] getUnparsedEntity(java.lang.String name)
getUnparsedEntity
in interface TreeInfo
getUnparsedEntity
in class GenericTreeInfo
name
- the name of the entitypublic NamePool getNamePool()
public void markTopWithinEntity(int nodeNr)
public boolean isTopWithinEntity(int nodeNr)
public void diagnosticDump()
public static void diagnosticDump(NodeInfo node)
node
- the node in questionpublic void showSize()
public boolean isTyped()
isTyped
in interface TreeInfo
isTyped
in interface NodeVectorTree
isTyped
in class GenericTreeInfo
public int getNumberOfNodes()
public int getNumberOfAttributes()
public int getNumberOfNamespaces()
public byte[] getNodeKindArray()
getNodeKindArray
in interface NodeVectorTree
public short[] getNodeDepthArray()
public int[] getNameCodeArray()
getNameCodeArray
in interface NodeVectorTree
public SchemaType[] getTypeArray()
public int[] getNextPointerArray()
public int[] getAlphaArray()
public int[] getBetaArray()
public AppendableCharSequence getCharacterBuffer()
public java.lang.CharSequence getCommentBuffer()
public int[] getAttributeNameCodeArray()
public SimpleType[] getAttributeTypeArray()
public int[] getAttributeParentArray()
public java.lang.CharSequence[] getAttributeValueArray()
public NamespaceBinding[] getNamespaceBindings()
public int[] getNamespaceParentArray()
public boolean isUsesNamespaces()
public void bulkCopy(TinyTree source, int nodeNr, int[] prevAtDepth, int currentDepth)
source
- the source treenodeNr
- the element node to be deep-copiedpublic void graft(NodeInfo externalNode, int nodeNr, int depth, boolean copyNamespaces)
public boolean containsGraftedSubtrees()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.