Interface InMemoryAtomSet
- All Superinterfaces:
AtomSet, CloseableIterable<Atom>, CloseableIterableWithoutException<Atom>, Iterable<Atom>
- All Known Implementing Classes:
AbstractInMemoryAtomSet, DefaultInMemoryAtomSet, LinkedListAtomSet
- Author:
- Clément Sipieter (INRIA) <clement@6pi.fr>
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd the specified atom to this atom set if is not already present.booleanaddAll(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 atoms with the specified predicate.voidclear()Removes all atoms from this atom set.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.iterator()Returns an iterator over the atoms in this atom set.Returns an iterator over all literals in this atom set.match(Atom atom, Substitution s) Returns an iterator over atoms that match predicate and constants from the specified atom.Returns a possibly parallelStreamwith this InMemoryAtomSet as its source.Returns an iterator over all predicates in this atom set.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.voidremoveWithoutCheck(Atom atom) Remove the specified atom from this this atom set.intsize()Returns the number of atoms in this set.default Spliterator<Atom> Creates aSpliteratorover the elements in this InMemoryAtomSet.stream()Returns a sequentialStreamwith this InMemoryAtomSet as its source.termsByPredicatePosition(Predicate p, int position) Returns an iterator over terms which are in a specific position in at least one atom with the specified predicate.Returns an iterator over all terms in this atom set.termsIterator(Term.Type type) Deprecated.Atom[]toArray()Copies the atoms of this set into an array.Returns an iterator over all variables in this atom set.Methods inherited from interface AtomSet
addAll, addAll, atomsByTerm, containsTerm, getFreshSymbolGenerator, match, removeAll, removeAll
-
Method Details
-
contains
-
match
Description copied from interface:AtomSetReturns an iterator over atoms that match predicate and constants from the specified atom. -
atomsByPredicate
Description copied from interface:AtomSetReturns an iterator over all atoms with the specified predicate.- Specified by:
atomsByPredicatein interfaceAtomSet- Parameters:
p- the predicate to search for- Returns:
- an iterator over all atoms with the specified predicate.
-
termsByPredicatePosition
Description copied from interface:AtomSetReturns an iterator over terms which are in a specific position in at least one atom with the specified predicate.- Specified by:
termsByPredicatePositionin interfaceAtomSet- Parameters:
p- the predicate to inspectposition- the term position in atoms, positions starts from 0.- Returns:
- an iterator over terms which appear in the specified position of the specified predicate.
-
getPredicates
Description copied from interface:AtomSetReturns a Set of all predicates in this atom set.- Specified by:
getPredicatesin interfaceAtomSet- Returns:
- a Set of all predicates.
-
predicatesIterator
CloseableIteratorWithoutException<Predicate> predicatesIterator()Description copied from interface:AtomSetReturns an iterator over all predicates in this atom set. Each predicate is iterated only once time.- Specified by:
predicatesIteratorin interfaceAtomSet- Returns:
- an iterator over all predicates.
-
getTerms
-
getVariables
Description copied from interface:AtomSetReturns a Set of all variables in this atom set.- Specified by:
getVariablesin interfaceAtomSet- 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- 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- Returns:
- a Set of all literals.
-
termsIterator
CloseableIteratorWithoutException<Term> termsIterator()Description copied from interface:AtomSetReturns an iterator over all terms in this atom set. Each term is iterated only once time.- Specified by:
termsIteratorin interfaceAtomSet- Returns:
- an iterator over all terms.
-
variablesIterator
CloseableIteratorWithoutException<Variable> 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- Returns:
- an iterator over all variables.
-
constantsIterator
CloseableIteratorWithoutException<Constant> 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- Returns:
- an iterator over all constants.
-
literalsIterator
CloseableIteratorWithoutException<Literal> 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- Returns:
- an iterator over 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. -
termsIterator
Deprecated.Description copied from interface:AtomSetThis method is deprecated since 1.3, useAtomSet.variablesIterator(),AtomSet.constantsIterator()orAtomSet.literalsIterator()instead.
Returns an iterator of all terms of the specified type in this atom set. Each term is iterated only once time.- Specified by:
termsIteratorin interfaceAtomSet- Parameters:
type- the term type to filter on- Returns:
- an iterator of all terms.
-
iterator
CloseableIteratorWithoutException<Atom> iterator()Description copied from interface:AtomSetReturns an iterator over the atoms in this atom set. -
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- Parameters:
atomset- the candidate superset- Returns:
- true if all atoms of this AtomSet are also contained in the specified atomset, false otherwise.
-
isEmpty
-
add
Description copied from interface:AtomSetAdd the specified atom to this atom set if is not already present. -
remove
-
removeWithoutCheck
Description copied from interface:AtomSetRemove the specified atom from this this atom set.- Specified by:
removeWithoutCheckin interfaceAtomSet- Parameters:
atom- the atom to be removed
-
clear
-
toArray
Atom[] toArray()Copies the atoms of this set into an array.- Returns:
- the atoms contained in this set
-
removeAll
Removes all atoms provided by the specified iterator.- Parameters:
atoms- the atoms to remove- Returns:
- true if this set changed as a result of the call
-
removeAll
Removes all atoms contained in the specified atom set.- Parameters:
atoms- the atoms to remove- Returns:
- true if this set changed as a result of the call
-
addAll
Adds all atoms from the specified in-memory atom set.- Parameters:
atoms- the atoms to add- Returns:
- true if this set changed as a result of the call
-
addAll
Adds all atoms produced by the specified iterator.- Parameters:
atoms- the atoms to add- Returns:
- true if this set changed as a result of the call
-
size
-
spliterator
Creates aSpliteratorover the elements in this InMemoryAtomSet.The
SpliteratorreportsSpliterator.DISTINCT. Implementations should document the reporting of additional characteristic values. The default implementation creates a late-binding spliterator from the InMemoryAtomSet'sIterator. The spliterator inherits the fail-fast properties of the InMemoryAtomSet's iterator.The created
Spliteratoradditionally reportsSpliterator.SIZED. The createdSpliteratoradditionally reportsSpliterator.SUBSIZED.- Specified by:
spliteratorin interfaceIterable<Atom>- Returns:
- a
Spliteratorover the elements in this InMemoryAtomSet
-
stream
Returns a sequentialStreamwith this InMemoryAtomSet as its source.This method should be overridden when the
spliterator()method cannot return a spliterator that isIMMUTABLE,CONCURRENT, or late-binding. (Seespliterator()for details.) The default implementation creates a sequentialStreamfrom the InMemoryAtomSetSpliterator.- Returns:
- a sequential
Streamover the elements in this InMemoryAtomSet
-
parallelStream
Returns a possibly parallelStreamwith this InMemoryAtomSet as its source. It is allowable for this method to return a sequential stream.This method should be overridden when the
spliterator()method cannot return a spliterator that isIMMUTABLE,CONCURRENT, or late-binding. (Seespliterator()for details.) The default implementation creates a parallelStreamfrom the InMemoryAtomSetSpliterator.- Returns:
- a possibly parallel
Streamover the elements in this InMemoryAtomSet
-