net.sf.saxon.om

Class TreeModel

public abstract class TreeModel extends Object implements Serializable

A TreeModel represents an implementation of the Saxon NodeInfo interface, which itself is essentially an implementation of the XDM model defined in W3C specifications (except that Saxon's NodeInfo understands the 13 XPath axes, rather than merely supporting parent and child properties).

This class serves two purposes: it acts as a factory for obtaining a Builder which can be used to build trees using this tree model; and it provides static constants that can be used to identify the built-in tree models.

Field Summary
static TreeModelLINKED_TREE
The LinkedTree.
static TreeModelTINY_TREE
The TinyTree implementation.
static TreeModelTINY_TREE_CONDENSED
The CondensedTinyTree implementation.
Method Summary
intgetSymbolicValue()
Get the integer constant used to identify this tree model in some legacy interfaces
static TreeModelgetTreeModel(int symbolicValue)
Get the tree model corresponding to a given integer constant
booleanisMutable()
Ask whether this tree model supports updating (that is, whether the nodes in the constructed tree will implement MutableNodeInfo, which is necessary if they are to support XQuery Update.
abstract BuildermakeBuilder()
Make a Builder to construct an instance of this tree model from a stream of events

Field Detail

LINKED_TREE

public static final TreeModel LINKED_TREE
The LinkedTree. This takes more memory than the TinyTree. The main advantage of this model is that it is updateable: the nodes in a LinkedTree can be modified using XQuery Updates.

TINY_TREE

public static final TreeModel TINY_TREE
The TinyTree implementation. This is normally the default implementation of the tree model.

TINY_TREE_CONDENSED

public static final TreeModel TINY_TREE_CONDENSED
The CondensedTinyTree implementation. This is a variant of the TinyTree that uses less memory but takes a little longer to build. Run-time performance is the same as the TinyTree.

Method Detail

getSymbolicValue

public int getSymbolicValue()
Get the integer constant used to identify this tree model in some legacy interfaces

Returns: an integer constant used to identify the model, for example TINY_TREE

getTreeModel

public static TreeModel getTreeModel(int symbolicValue)
Get the tree model corresponding to a given integer constant

Parameters: symbolicValue one of the constants TINY_TREE, TINY_TREE_CONDENSED, or LINKED_TREE

Returns: the corresponding TreeModel

isMutable

public boolean isMutable()
Ask whether this tree model supports updating (that is, whether the nodes in the constructed tree will implement MutableNodeInfo, which is necessary if they are to support XQuery Update. This method can be overridden in subclasses; the default implementation returns false.

Returns: true if the tree model implementation supports updating, that is, if its nodes support the MutableNodeInfo interface.

makeBuilder

public abstract Builder makeBuilder()
Make a Builder to construct an instance of this tree model from a stream of events

Returns: a newly created Builder