org.deri.iris.builtins
Class MultiplyBuiltin

java.lang.Object
  extended by org.deri.iris.builtins.AbstractBuiltin
      extended by org.deri.iris.builtins.ArithmeticBuiltin
          extended by org.deri.iris.builtins.MultiplyBuiltin
All Implemented Interfaces:
Comparable<IAtom>, IAtom, IBuiltinAtom
Direct Known Subclasses:
DayTimeDurationMultiplyBuiltin, NumericMultiplyBuiltin, YearMonthDurationMultiplyBuiltin

public class MultiplyBuiltin
extends ArithmeticBuiltin

Represents a multiply operation. In at the evaluation time there must be only one variable be left for computation, otherwise an exception will be thrown.

Version:
$Revision: 1.15 $
Author:
Richard P??ttler, richard dot poettler at deri dot org

Field Summary
 
Fields inherited from class org.deri.iris.builtins.AbstractBuiltin
EMPTY_TERM
 
Constructor Summary
protected MultiplyBuiltin(IPredicate predicate, ITerm... terms)
          Construct a new MultiplyBuiltin for the specific predicate and terms.
  MultiplyBuiltin(ITerm... terms)
          Constructs a builtin.
 
Method Summary
protected  ITerm computeMissingTerm(int missingTermIndex, ITerm[] terms)
          Compute the missing term when the other two are known.
 
Methods inherited from class org.deri.iris.builtins.ArithmeticBuiltin
evaluateTerms, maxUnknownVariables, testForEquality
 
Methods inherited from class org.deri.iris.builtins.AbstractBuiltin
compareTo, equals, evaluate, getPredicate, getTuple, hashCode, isBuiltin, isGround, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiplyBuiltin

protected MultiplyBuiltin(IPredicate predicate,
                          ITerm... terms)
Construct a new MultiplyBuiltin 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.

MultiplyBuiltin

public MultiplyBuiltin(ITerm... terms)
Constructs a builtin. Three terms must be passed to the constructor, otherwise an exception will be thrown.

Parameters:
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.
Method Detail

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