java.lang.Object
org.apache.jena.mem2.store.fast.FastArrayBunch
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Copyable<FastTripleBunch>,JenaMapSetCommon<Triple>,JenaSet<Triple>,JenaSetHashOptimized<Triple>,FastTripleBunch
An ArrayBunch implements TripleBunch with a linear search of a short-ish
array of Triples. The array grows by factor 2.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the key to the set without checking if it is already present.voidaddUnchecked(Triple key, int hashCode) booleanCheck whether the collection contains any element matching the predicate.booleananyMatchRandomOrder(Predicate<Triple> predicate) This method is used to optimize _PO match operations.abstract booleanvoidclear()Clear the collection.booleanCheck whether the collection contains a given key.booleanisArray()Answer true iff this bunch is implemented as an array.booleanisEmpty()Get an iterator over the keys in the collection.Get a spliterator over the keys in the collection.voidRemoves a key from the collection.voidremoveUnchecked(Triple key, int hashCode) intsize()booleanAdd the key to the set if it is not already present.booleanbooleanTries to remove a key from the collection.booleanMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jena.atlas.lib.Copyable
copyMethods inherited from interface org.apache.jena.mem2.collection.JenaMapSetCommon
keyStream, keyStreamParallel
-
Method Details
-
areEqual
-
containsKey
Description copied from interface:JenaMapSetCommonCheck whether the collection contains a given key.- Specified by:
containsKeyin interfaceJenaMapSetCommon<Triple>- Parameters:
t- the key to look for- Returns:
- true if the collection contains the key
-
anyMatch
Description copied from interface:JenaMapSetCommonCheck whether the collection contains any element matching the predicate.- Specified by:
anyMatchin interfaceJenaMapSetCommon<Triple>- Parameters:
predicate- the predicate to match- Returns:
- true if the collection contains any element matching the predicate
-
anyMatchRandomOrder
Description copied from interface:FastTripleBunchThis method is used to optimize _PO match operations. TheJenaMapSetCommon.anyMatch(Predicate)method is faster if there are only a few matches. This method is faster if there are many matches and the set is ordered in an unfavorable way. _PO matches usually fall into this category.- Specified by:
anyMatchRandomOrderin interfaceFastTripleBunch- Parameters:
predicate- the predicate to match- Returns:
- true if any triple in the bunch matches the predicate
-
clear
public void clear()Description copied from interface:JenaMapSetCommonClear the collection.- Specified by:
clearin interfaceJenaMapSetCommon<Triple>
-
size
public int size()- Specified by:
sizein interfaceJenaMapSetCommon<Triple>- Returns:
- the number of elements in the collection
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceJenaMapSetCommon<Triple>- Returns:
- true if the collection is empty
-
tryAdd
Description copied from interface:JenaSetAdd the key to the set if it is not already present. -
addUnchecked
Description copied from interface:JenaSetAdd the key to the set without checking if it is already present. Attention: This method must only be used if it is guaranteed that the key is not already present.- Specified by:
addUncheckedin interfaceJenaSet<Triple>- Parameters:
t- the key to add
-
tryRemove
Description copied from interface:JenaMapSetCommonTries to remove a key from the collection.- Specified by:
tryRemovein interfaceJenaMapSetCommon<Triple>- Parameters:
t- the key to remove- Returns:
- true if the key was removed. If the key was not present, false is returned.
-
removeUnchecked
Description copied from interface:JenaMapSetCommonRemoves a key from the collection. Attention: Implementations may assume that the key is present.- Specified by:
removeUncheckedin interfaceJenaMapSetCommon<Triple>- Parameters:
t- the key to remove
-
keyIterator
Description copied from interface:JenaMapSetCommonGet an iterator over the keys in the collection.- Specified by:
keyIteratorin interfaceJenaMapSetCommon<Triple>- Returns:
- an iterator over the keys in the collection
-
keySpliterator
Description copied from interface:JenaMapSetCommonGet a spliterator over the keys in the collection.- Specified by:
keySpliteratorin interfaceJenaMapSetCommon<Triple>- Returns:
- a spliterator over the keys in the collection
-
isArray
public boolean isArray()Description copied from interface:FastTripleBunchAnswer true iff this bunch is implemented as an array. This field is used to optimize some operations by avoiding the need for instanceOf tests.- Specified by:
isArrayin interfaceFastTripleBunch- Returns:
- true iff this bunch is implemented as an arrays
-
tryAdd
- Specified by:
tryAddin interfaceJenaSetHashOptimized<Triple>
-
addUnchecked
- Specified by:
addUncheckedin interfaceJenaSetHashOptimized<Triple>
-
tryRemove
- Specified by:
tryRemovein interfaceJenaSetHashOptimized<Triple>
-
removeUnchecked
- Specified by:
removeUncheckedin interfaceJenaSetHashOptimized<Triple>
-