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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Attempts 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 void
void
resetState
(int conj) toString()
-
Constructor Details
-
ClauseSubstitution
-
-
Method Details
-
getCleanCopy
-
add
Description copied from interface:ConstOnlySubstitution
Attempts 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:
add
in interfaceConstOnlySubstitution
- Parameters:
x
- the variablec
- the constant- Returns:
- whether the mapping was successfully added
-
get
Description copied from interface:ConstOnlySubstitution
Retrieves the mapping of a variable.- Specified by:
get
in interfaceConstOnlySubstitution
- Specified by:
get
in 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:Substitution
Apply this substitution to a list of terms, creating a new list.- Specified by:
apply
in interfaceSubstitution
- Parameters:
original
- the original list- Returns:
- the new list
-