ubc.cs.JLog.Terms
Class iPredicate
java.lang.Object
ubc.cs.JLog.Foundation.jType
ubc.cs.JLog.Terms.jTerm
ubc.cs.JLog.Terms.iPredicate
- All Implemented Interfaces:
- iType, iUnifiable, iConsultable, iName, iNameArity, iTerm, iValue
- Direct Known Subclasses:
- jAtom, jBuiltinPredicate, jOrPredicate, jPredicate
public abstract class iPredicate
- extends jTerm
- implements iNameArity
This is the abstract base class for Prolog predicates.
- Version:
- %I%, %G%
- Author:
- Glendon Holst
| Fields inherited from class ubc.cs.JLog.Foundation.jType |
type |
| Fields inherited from interface ubc.cs.JLog.Foundation.iType |
TYPE_ARITHMETIC, TYPE_ATOM, TYPE_BUILTINPREDICATE, TYPE_COMMAND, TYPE_COMPARE, TYPE_COMPOUND, TYPE_CONS, TYPE_IF, TYPE_INTEGER, TYPE_LIST, TYPE_NULLLIST, TYPE_NUMERICCOMPARE, TYPE_OBJECT, TYPE_OPERATOR, TYPE_OR, TYPE_ORPREDICATE, TYPE_PREDICATE, TYPE_PREDICATETERMS, TYPE_REAL, TYPE_TYPE, TYPE_UNARYARITHMETIC, TYPE_UNARYOPERATOR, TYPE_UNDEFINED, TYPE_VARIABLE |
| Methods inherited from class ubc.cs.JLog.Terms.jTerm |
compare, consult, consultReset, copy, copy, duplicate, enumerateVariables, equivalence, getName, getTerm, getValue, isConsultNeeded, registerUnboundVariables, registerVariables, requiresCompleteVariableState, toString, toString, unify |
| Methods inherited from interface ubc.cs.JLog.Terms.iName |
getName |
iPredicate
public iPredicate()
compare
protected int compare(jTerm term,
boolean first_call,
boolean var_equal)
- Description copied from class:
jTerm
- The private member function for term comparision. Compares this instance to the
provided
jTerm. sub-classes must override.
- Specified by:
compare in class jTerm
- Parameters:
term - the jTerm to compare with this instance of
jTerm. if
term is an unknown type then, if
first_call is
true, call term.compare(this,false) and return
the negative result, otherwise return EQUAL.first_call - true if just invoked by public
compare member function.
false otherwise.var_equal - if var_equal is true, then unbound
variables are considered equal.
var_equal = false is standard prolog
behavior.
- Returns:
LESS_THAN if this instance is less than
term,
EQUAL if the two terms are equal, and
GREATER_THAN if
this instance is greater than term.
compareArguments
protected abstract int compareArguments(iPredicate ipred,
boolean first_call,
boolean var_equal)
- Compares the arguments for predicates. Like
compare except that name
and arity must be equal.
- Parameters:
ipred - the iPredicate to compare with this instance of
iPredicate.first_call - true if just invoked by public
compare member function.
false otherwise.var_equal - if var_equal is true, then unbound
variables are considered equal.
var_equal = false is standard prolog
behavior.
- Returns:
LESS_THAN if this instance is less than
term,
EQUAL if the two terms are equal, and
GREATER_THAN if
this instance is greater than term.
getArguments
public jCompoundTerm getArguments()
- Accessor for the arguments for this predicate. Don't modify arguments after consult.
Arguments are not guaranteed to be original so modifying has an unspecified effect.
- Returns:
- The original or possibly duplicated arguments for this predicate.
addGoals
public abstract void addGoals(jGoal g,
jVariable[] vars,
iGoalStack goals)
- Adds goal to prove this predicate onto goal stack. This version is called when
the original predicate must duplicate itself (or its arguments).
Add goals in the reverse order you want them evaluated.
- Parameters:
g - The super-goal jGoal for the sub-goal that this
function will add.vars - The vector of duplicate variables produced
from the previous call to registerVariables.
Needed for call to duplicate.goals - The iGoalStack to add the goal to.
addGoals
public abstract void addGoals(jGoal g,
iGoalStack goals)
- Adds goal to prove this predicate onto goal stack. This version is called when
the original predicate is already duplicated (usually as part of an argument for
another predicate). Add goals in the reverse order you want them evaluated.
- Parameters:
g - The super-goal jGoal for the sub-goal that this
function will add.goals - The iGoalStack to add the goal to.
Copyright © 2011. All Rights Reserved.