Class ClauseSubstitution
java.lang.Object
edu.harvard.seas.pl.abcdatalog.util.substitution.ClauseSubstitution
- All Implemented Interfaces:
ConstOnlySubstitution,Substitution
This is a substitution tailor-made for a particular clause. Mappings can only be added to the
substitution in the order in which the variables appear in the clause. The state of the
substitution can be reset (so that it "forgets" the most recent mappings).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAttempts to add a mapping to the substitution.Term[]Apply this substitution to a list of terms, creating a new list.Retrieves the mapping of a variable.static voidvoidresetState(int conj) toString()
-
Constructor Details
-
ClauseSubstitution
-
-
Method Details
-
getCleanCopy
-
add
Description copied from interface:ConstOnlySubstitutionAttempts to add a mapping to the substitution. Returns true if the mapping was made successfully (i.e., if the variable was not already mapped to another constant).- Specified by:
addin interfaceConstOnlySubstitution- Parameters:
x- the variablec- the constant- Returns:
- whether the mapping was successfully added
-
get
Description copied from interface:ConstOnlySubstitutionRetrieves the mapping of a variable.- Specified by:
getin interfaceConstOnlySubstitution- Specified by:
getin interfaceSubstitution- Parameters:
x- the variable- Returns:
- the constant that the variable is bound to, or null if the variable is not in the substitution
-
resetState
public void resetState(int conj) -
toString
-
main
- Throws:
DatalogValidationException
-
apply
Description copied from interface:SubstitutionApply this substitution to a list of terms, creating a new list.- Specified by:
applyin interfaceSubstitution- Parameters:
original- the original list- Returns:
- the new list
-