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
ConstructorDescriptionImmutableLiteralsList
(Literal... literal) ImmutableLiteralsList
(List<Literal> literalList) -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(LogicSchemaVisitor<T> visitor) void
Deprecated.Unsupported operation.boolean
Deprecated.Unsupported operation.boolean
addAll
(int index, Collection<? extends Literal> c) Deprecated.Unsupported operation.boolean
addAll
(Collection<? extends Literal> c) Deprecated.Unsupported operation.applySubstitution
(Substitution substitution) void
clear()
Deprecated.Unsupported operation.boolean
boolean
containsAll
(Collection<?> c) boolean
get
(int index) getLiteralPositionWithVariable
(Variable variable) getOriginalLiteral
(Literal currentLiteral) getOriginalLiteralPosition
(Literal currentLiteral, int termIndex) getPredicatePositionsWithVar
(Variable variable) int
hashCode()
int
boolean
isEmpty()
iterator()
int
listIterator
(int index) remove
(int index) Deprecated.Unsupported operation.boolean
Deprecated.Unsupported operation.boolean
removeAll
(Collection<?> c) Deprecated.Unsupported operation.boolean
retainAll
(Collection<?> c) Deprecated.Unsupported operation.Deprecated.Unsupported operation.int
size()
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, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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
-
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:
containsAll
in interfaceCollection<Literal>
- Specified by:
containsAll
in 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:
lastIndexOf
in interfaceList<Literal>
-
listIterator
- Specified by:
listIterator
in interfaceList<Literal>
-
listIterator
- Specified by:
listIterator
in interfaceList<Literal>
-
subList
-
applySubstitution
-
getUsedVariables
-
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
-
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
-
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
-
toString
-
accept
-
equals
-
hashCode
public int hashCode()
-