Class AbstractInMemoryAtomSet
java.lang.Object
fr.lirmm.graphik.integraal.core.atomset.AbstractAtomSet
fr.lirmm.graphik.integraal.core.atomset.AbstractInMemoryAtomSet
- All Implemented Interfaces:
AtomSet, InMemoryAtomSet, CloseableIterable<Atom>, CloseableIterableWithoutException<Atom>, Iterable<Atom>
- Direct Known Subclasses:
DefaultInMemoryAtomSet, LinkedListAtomSet
Base implementation for in-memory atom sets.
- Author:
- Clément Sipieter (INRIA) <clement@6pi.fr>
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates an abstract in-memory atom set base implementation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAll(InMemoryAtomSet atoms) Adds all atoms from the specified in-memory atom set.booleanaddAll(CloseableIteratorWithoutException<? extends Atom> atoms) Adds all atoms produced by the specified iterator.Returns an iterator over all constants in this atom set.booleanReturns true if this atom set contains the specified atom.Returns a Set of all constants in this atom set.Returns a Set of all literals in this atom set.Returns a Set of all predicates in this atom set.getTerms()Returns a Set of all terms in this atom set.Deprecated.Returns a Set of all variables in this atom set.booleanisEmpty()Returns whether this atom set contains no atom.booleanisSubSetOf(AtomSet atomset) Deprecated.Returns an iterator over all literals in this atom set.Returns an iterator over atoms that match predicate and constants from the specified atom.booleanRemove the specified atom from this this atom set.booleanremoveAll(InMemoryAtomSet atoms) Removes all atoms contained in the specified atom set.booleanremoveAll(CloseableIteratorWithoutException<? extends Atom> atoms) Removes all atoms provided by the specified iterator.intsize()This default implementation should be overriden, it is convenient for in memory set, but will be inefficient in some case.Atom[]toArray()Copies the atoms of this set into an array.Returns an iterator over all variables in this atom set.Methods inherited from class AbstractAtomSet
addAll, addAll, equals, equals, removeAll, removeAll, toStringMethods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface AtomSet
addAll, addAll, atomsByTerm, containsTerm, getFreshSymbolGenerator, removeAll, removeAllMethods inherited from interface InMemoryAtomSet
add, atomsByPredicate, clear, iterator, match, parallelStream, predicatesIterator, removeWithoutCheck, spliterator, stream, termsByPredicatePosition, termsIterator, termsIterator
-
Constructor Details
-
AbstractInMemoryAtomSet
protected AbstractInMemoryAtomSet()Creates an abstract in-memory atom set base implementation.
-
-
Method Details
-
contains
Description copied from interface:AtomSetReturns true if this atom set contains the specified atom.- Specified by:
containsin interfaceAtomSet- Specified by:
containsin interfaceInMemoryAtomSet- Overrides:
containsin classAbstractAtomSet- Parameters:
atom- the atom to search for- Returns:
- true if this atom set contains the specified atom.
-
addAll
Description copied from interface:InMemoryAtomSetAdds all atoms produced by the specified iterator.- Specified by:
addAllin interfaceInMemoryAtomSet- Parameters:
atoms- the atoms to add- Returns:
- true if this set changed as a result of the call
-
addAll
Description copied from interface:InMemoryAtomSetAdds all atoms from the specified in-memory atom set.- Specified by:
addAllin interfaceInMemoryAtomSet- Parameters:
atoms- the atoms to add- Returns:
- true if this set changed as a result of the call
-
remove
Description copied from interface:AtomSetRemove the specified atom from this this atom set.- Specified by:
removein interfaceAtomSet- Specified by:
removein interfaceInMemoryAtomSet- Overrides:
removein classAbstractAtomSet- Parameters:
atom- the atom to be removed- Returns:
- true if this atom set contained the specified atom.
-
removeAll
Description copied from interface:InMemoryAtomSetRemoves all atoms provided by the specified iterator.- Specified by:
removeAllin interfaceInMemoryAtomSet- Parameters:
atoms- the atoms to remove- Returns:
- true if this set changed as a result of the call
-
removeAll
Description copied from interface:InMemoryAtomSetRemoves all atoms contained in the specified atom set.- Specified by:
removeAllin interfaceInMemoryAtomSet- Parameters:
atoms- the atoms to remove- Returns:
- true if this set changed as a result of the call
-
match
Description copied from interface:AtomSetReturns an iterator over atoms that match predicate and constants from the specified atom.- Specified by:
matchin interfaceAtomSet- Overrides:
matchin classAbstractAtomSet- Parameters:
atom- the atom pattern to match- Returns:
- an iterator over atoms.
- Throws:
AtomSetException- if the match operation fails
-
getTerms
Description copied from interface:AtomSetReturns a Set of all terms in this atom set.- Specified by:
getTermsin interfaceAtomSet- Specified by:
getTermsin interfaceInMemoryAtomSet- Overrides:
getTermsin classAbstractAtomSet- Returns:
- a Set of all terms.
-
getVariables
Description copied from interface:AtomSetReturns a Set of all variables in this atom set.- Specified by:
getVariablesin interfaceAtomSet- Specified by:
getVariablesin interfaceInMemoryAtomSet- Overrides:
getVariablesin classAbstractAtomSet- Returns:
- a Set of all variables.
-
getConstants
Description copied from interface:AtomSetReturns a Set of all constants in this atom set.- Specified by:
getConstantsin interfaceAtomSet- Specified by:
getConstantsin interfaceInMemoryAtomSet- Overrides:
getConstantsin classAbstractAtomSet- Returns:
- a Set of all constants.
-
getLiterals
Description copied from interface:AtomSetReturns a Set of all literals in this atom set.- Specified by:
getLiteralsin interfaceAtomSet- Specified by:
getLiteralsin interfaceInMemoryAtomSet- Overrides:
getLiteralsin classAbstractAtomSet- Returns:
- a Set of all literals.
-
getTerms
Deprecated.Description copied from interface:AtomSetThis method is deprecated since 1.3, useAtomSet.getVariables(),AtomSet.getConstants()orAtomSet.getLiterals()instead.
Returns a Set of all terms of the specified type in this atom set.- Specified by:
getTermsin interfaceAtomSet- Specified by:
getTermsin interfaceInMemoryAtomSet- Overrides:
getTermsin classAbstractAtomSet- Parameters:
type- the term type to filter on- Returns:
- a collection of all terms of the specified type in this atom set.
-
variablesIterator
Description copied from interface:AtomSetReturns an iterator over all variables in this atom set. Each term is iterated only once time.- Specified by:
variablesIteratorin interfaceAtomSet- Specified by:
variablesIteratorin interfaceInMemoryAtomSet- Overrides:
variablesIteratorin classAbstractAtomSet- Returns:
- an iterator over all variables.
-
constantsIterator
Description copied from interface:AtomSetReturns an iterator over all constants in this atom set. Each term is iterated only once time.- Specified by:
constantsIteratorin interfaceAtomSet- Specified by:
constantsIteratorin interfaceInMemoryAtomSet- Overrides:
constantsIteratorin classAbstractAtomSet- Returns:
- an iterator over all constants.
-
literalsIterator
Description copied from interface:AtomSetReturns an iterator over all literals in this atom set. Each term is iterated only once time.- Specified by:
literalsIteratorin interfaceAtomSet- Specified by:
literalsIteratorin interfaceInMemoryAtomSet- Overrides:
literalsIteratorin classAbstractAtomSet- Returns:
- an iterator over all literals.
-
getPredicates
Description copied from interface:AtomSetReturns a Set of all predicates in this atom set.- Specified by:
getPredicatesin interfaceAtomSet- Specified by:
getPredicatesin interfaceInMemoryAtomSet- Overrides:
getPredicatesin classAbstractAtomSet- Returns:
- a Set of all predicates.
-
isSubSetOf
Deprecated.Description copied from interface:AtomSetUse AtomSets.contains instead. Check if all atoms of this AtomSet are also contained in the specified AtomSet.- Specified by:
isSubSetOfin interfaceAtomSet- Specified by:
isSubSetOfin interfaceInMemoryAtomSet- Overrides:
isSubSetOfin classAbstractAtomSet- Parameters:
atomset- the candidate superset- Returns:
- true if all atoms of this AtomSet are also contained in the specified atomset, false otherwise.
-
isEmpty
public boolean isEmpty()Description copied from interface:AtomSetReturns whether this atom set contains no atom.- Specified by:
isEmptyin interfaceAtomSet- Specified by:
isEmptyin interfaceInMemoryAtomSet- Overrides:
isEmptyin classAbstractAtomSet- Returns:
- true if this atom set is empty, false otherwise.
-
toArray
Description copied from interface:InMemoryAtomSetCopies the atoms of this set into an array.- Specified by:
toArrayin interfaceInMemoryAtomSet- Returns:
- the atoms contained in this set
-
size
public int size()Description copied from class:AbstractAtomSetThis default implementation should be overriden, it is convenient for in memory set, but will be inefficient in some case.- Specified by:
sizein interfaceAtomSet- Specified by:
sizein interfaceInMemoryAtomSet- Overrides:
sizein classAbstractAtomSet- Returns:
- the number of atoms in the set
- See Also:
-