org.deri.iris.builtins
Class ModulusBuiltin
java.lang.Object
org.deri.iris.builtins.AbstractBuiltin
org.deri.iris.builtins.ArithmeticBuiltin
org.deri.iris.builtins.ModulusBuiltin
- All Implemented Interfaces:
- Comparable<IAtom>, IAtom, IBuiltinAtom
- Direct Known Subclasses:
- NumericModulusBuiltin
public class ModulusBuiltin
- extends ArithmeticBuiltin
Represents a modulus operation. At evaluation time there must be either:
a) 1 unknown variable for computation, OR
b) no unknown variables, in which case the evaluation is just a check that term0 % term1 = term2
|
Method Summary |
protected ITerm |
computeMissingTerm(int missingTermIndex,
ITerm[] terms)
Compute the missing term when the other two are known. |
ModulusBuiltin
protected ModulusBuiltin(IPredicate predicate,
ITerm... terms)
- Construct a new ModulusBuiltin for the specific predicate and terms.
- Parameters:
predicate - The predicate of the built-in.terms - The terms.
- Throws:
NullPointerException - If the predicate or one of the terms is
null.
IllegalArgumentException - If the length of the terms and the arity
of the predicate do not match.
ModulusBuiltin
public ModulusBuiltin(ITerm... terms)
- Constructor.
- Parameters:
terms - the terms. There must always be 3 terms.
computeMissingTerm
protected ITerm computeMissingTerm(int missingTermIndex,
ITerm[] terms)
throws EvaluationException
- Description copied from class:
ArithmeticBuiltin
- Compute the missing term when the other two are known.
- Specified by:
computeMissingTerm in class ArithmeticBuiltin
terms - The collection of all terms.
- Returns:
- The computed value.
- Throws:
EvaluationException