Class TreeModel

java.lang.Object
All Implemented Interfaces:
Serializable, Iterable<Statement>, Collection<Statement>, Set<Statement>, SortedSet<Statement>, Model, NamespaceAware

public class TreeModel extends AbstractModel implements SortedSet<Statement>
A Red-Black tree based Model implementation. The model is sorted according to the lexical ordering of terms.

This implementation provides guaranteed log(n) time cost for filtered access by any number of terms. If an index is not yet available for a set of positions, it is created at runtime using a TreeSet.

Note that this implementation is not synchronized. If multiple threads access a model concurrently, even if all of them are read operations, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the model. If no such object exists, the set should be "wrapped" using the Models.synchronizedModel method.

Author:
James Leigh
See Also: