Class ImmutableLiteralsList
When the immutable list has been created through an unfolding, or applying a substitution, it remembers which literals has been replaced with which other literals
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableLiteralsList(Literal... literal) ImmutableLiteralsList(List<Literal> literalList) -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(LogicSchemaVisitor<T> visitor) voidDeprecated.Unsupported operation.booleanDeprecated.Unsupported operation.booleanaddAll(int index, Collection<? extends Literal> c) Deprecated.Unsupported operation.booleanaddAll(Collection<? extends Literal> c) Deprecated.Unsupported operation.applySubstitution(Substitution substitution) voidclear()Deprecated.Unsupported operation.booleanbooleancontainsAll(Collection<?> c) booleanget(int index) getLiteralPositionWithVariable(Variable variable) getOriginalLiteral(Literal currentLiteral) getOriginalLiteralPosition(Literal currentLiteral, int termIndex) getPredicatePositionsWithVar(Variable variable) inthashCode()intbooleanisEmpty()iterator()intlistIterator(int index) remove(int index) Deprecated.Unsupported operation.booleanDeprecated.Unsupported operation.booleanremoveAll(Collection<?> c) Deprecated.Unsupported operation.booleanretainAll(Collection<?> c) Deprecated.Unsupported operation.Deprecated.Unsupported operation.intsize()sortLiterals(Comparator<Literal> literalComparator) Sort literals according to literalComparatorsubList(int fromIndex, int toIndex) Object[]toArray()<T> T[]toArray(T[] a) toString()unfold(int index) Unfolding a literal returns a list of literals' list, one for each derivation rule of this literal.unfold(int index, boolean unfoldNegatedLiterals) unfoldWithNegationExtension(int index) This is an extension of the unfold method that also applies an unfolding for negated literals whose derivation rules does not contain existential variables.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Constructor Details
-
ImmutableLiteralsList
-
ImmutableLiteralsList
-
-
Method Details
-
getPredicatePositionsWithVar
- Parameters:
variable- not null- Returns:
- a set of PredicatePositions appearing in literals that contains the given variable
-
getLiteralPositionWithVariable
- Parameters:
variable- not null- Returns:
- a set of LiteralPositions appearing in literals that contains the given variable
-
sortLiterals
Sort literals according to literalComparator- Returns:
- a new sorted list of literals
-
getVariablesInPositiveOrdinaryLiterals
-
getVariablesInNegativeOrdinaryLiterals
-
getVariablesInBuiltInLiterals
-
unfoldRecursively
- Returns:
- a list of ImmutableLiteralsList after recursively unfolding all the positive derived non-recursive literals, or itself if no unfolding can be applied
-
unfold
Unfolding a literal returns a list of literals' list, one for each derivation rule of this literal. In particular, for each derivation rule, it returns a literals' list replacing the variables of the derivation rule's head for the terms appearing in this literal.
For instance, if we have the literal list "P(1), Q(z)", with derivation rules "P(x) :- R(x), S(x)" and "P(y) :- T(y), U(y)", unfolding the first literal of "P(1), Q(z)" will return two literals' list: "R(1), S(1), Q(z)" and "T(1), U(1), Q(z)".
This unfolding avoids clashing the variables inside the derivation rule's body with the variables appearing in this literal. For instance, if we have the list "P(a, b), Q(z)" with a derivation rule "P(x, y) :- R(x, y, a, b, z)", and we unfold the first literal it will return "R(a, b, a', b', z'), Q(z)"
If the literal proposed to be unfolded, is base, or it is negated, or it is built in, it returns the very same literals' list.
- Returns:
- a list of ImmutableLiteralsList representing the result of unfolding the index-th literal
-
unfold
-
applySubstitution
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
Deprecated.Unsupported operation. -
remove
Deprecated.Unsupported operation. -
containsAll
- Specified by:
containsAllin interfaceCollection<Literal>- Specified by:
containsAllin interfaceList<Literal>
-
addAll
Deprecated.Unsupported operation. -
addAll
Deprecated.Unsupported operation. -
removeAll
Deprecated.Unsupported operation. -
retainAll
Deprecated.Unsupported operation. -
clear
Deprecated.Unsupported operation. -
get
-
set
Deprecated.Unsupported operation. -
add
Deprecated.Unsupported operation. -
remove
Deprecated.Unsupported operation. -
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<Literal>
-
listIterator
- Specified by:
listIteratorin interfaceList<Literal>
-
listIterator
- Specified by:
listIteratorin interfaceList<Literal>
-
subList
-
getUsedVariables
-
unfoldWithNegationExtension
This is an extension of the unfold method that also applies an unfolding for negated literals whose derivation rules does not contain existential variables. E.g.: Suppose the literals list "P(x), not(Derived(x))" with derivation rule "Derived(x) :- A(x), not(B(x))"Unfolding not(Derived()) in such literals list will return two literals list: "P(x), not(A(x))" and "P(x), B(x)".
- Returns:
- a list of ImmutableLiteralsList representing the result of unfolding the index-th literal
-
getOriginalLiteral
- Parameters:
currentLiteral- not null- Returns:
- the literal that has created the given literal through an unfolding, or through applying a substitution to a previous ImmutableLiteralsList.
-
getOriginalLiteralPosition
-
accept
-
hashCode
public int hashCode() -
equals
-
toString
-