Package org.eclipse.rdf4j.model.impl
Class TreeModel
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<Statement>
-
- org.eclipse.rdf4j.model.impl.AbstractModel
-
- org.eclipse.rdf4j.model.impl.TreeModel
-
- 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 basedModelimplementation. 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:
- Serialized Form
-
-
Method Summary
-
Methods inherited from class org.eclipse.rdf4j.model.impl.AbstractModel
add, addAll, clear, closeIterator, contains, containsAll, contexts, objects, predicates, remove, removeAll, retainAll, subjects, toArray, toArray, unmodifiable
-
Methods inherited from class java.util.AbstractSet
equals, hashCode
-
Methods inherited from class java.util.AbstractCollection
toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.rdf4j.model.Model
getStatements
-
Methods inherited from interface java.util.Set
add, addAll, contains, containsAll, equals, hashCode, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from interface java.util.SortedSet
spliterator
-
-
-
-
Constructor Detail
-
TreeModel
public TreeModel()
-
TreeModel
public TreeModel(Model model)
-
TreeModel
public TreeModel(Collection<? extends Statement> c)
-
TreeModel
public TreeModel(Set<Namespace> namespaces, Collection<? extends Statement> c)
-
-
Method Detail
-
getNamespace
public Optional<Namespace> getNamespace(String prefix)
- Specified by:
getNamespacein interfaceNamespaceAware
-
getNamespaces
public Set<Namespace> getNamespaces()
- Specified by:
getNamespacesin interfaceNamespaceAware
-
setNamespace
public Namespace setNamespace(String prefix, String name)
- Specified by:
setNamespacein interfaceModel
-
setNamespace
public void setNamespace(Namespace namespace)
- Specified by:
setNamespacein interfaceModel
-
removeNamespace
public Optional<Namespace> removeNamespace(String prefix)
- Specified by:
removeNamespacein interfaceModel
-
size
public int size()
- Specified by:
sizein interfaceCollection<Statement>- Specified by:
sizein interfaceSet<Statement>- Specified by:
sizein classAbstractCollection<Statement>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<Statement>- Specified by:
clearin interfaceSet<Statement>- Overrides:
clearin classAbstractModel
-
comparator
public Comparator<? super Statement> comparator()
- Specified by:
comparatorin interfaceSortedSet<Statement>
-
pollFirst
public Statement pollFirst()
-
pollLast
public Statement pollLast()
-
removeTermIteration
public void removeTermIteration(Iterator<Statement> iterator, Resource subj, IRI pred, Value obj, Resource... contexts)
Description copied from class:AbstractModelCalled by aggregate sets when a term has been removed from a term iterator. Exactly one of the last four terms will be non-empty.- Specified by:
removeTermIterationin classAbstractModel- Parameters:
iterator- The iterator used to navigate the live set (never null)subj- the subject term to be removed or nullpred- the predicate term to be removed or nullobj- the object term to be removed or nullcontexts- an array of one context term to be removed or an empty array
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<Statement>- Specified by:
isEmptyin interfaceSet<Statement>- Overrides:
isEmptyin classAbstractModel
-
-