ubc.cs.JLog.Terms
Class jPredicateTerms

java.lang.Object
  extended by ubc.cs.JLog.Foundation.jType
      extended by ubc.cs.JLog.Terms.jTerm
          extended by ubc.cs.JLog.Terms.jCompoundTerm
              extended by ubc.cs.JLog.Terms.jPredicateTerms
All Implemented Interfaces:
iType, iUnifiable, iConsultable, iMakeUnmake, iName, iTerm, iValue

public class jPredicateTerms
extends jCompoundTerm

This class represents a collection of predicates.

Author:
Glendon Holst

Field Summary
 
Fields inherited from class ubc.cs.JLog.Terms.jCompoundTerm
terms
 
Fields inherited from class ubc.cs.JLog.Foundation.jType
type
 
Fields inherited from interface ubc.cs.JLog.Terms.iTerm
EQUAL, GREATER_THAN, LESS_THAN
 
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
 
Constructor Summary
  jPredicateTerms()
           
protected jPredicateTerms(java.util.Vector t)
           
 
Method Summary
 void addGoals(jGoal g, iGoalStack goals)
           
 void addGoals(jGoal g, jVariable[] vars, iGoalStack goals)
           
 void addPredicate(iPredicate p)
           
 void addTerm(jTerm t)
           
 jTerm copy(jVariableRegistry vars)
          Internal member function which creates a copy of this term.
 jTerm duplicate(jVariable[] vars)
          Creates a complete and entirely independant duplicate of this term.
protected  java.lang.String getEndingSymbol()
           
protected  java.lang.String getStartingSymbol()
           
 void make(jTerm t)
          Makes this a representation of the provided jTerm, which may include conjunction and disjunction operators.
protected  void makeConsPredicateTerms(jTerm term)
          Add jCons separated jTerms to this jPredicateTerms instance.
protected  void makeOrPredicateTerms(jOrPredicate orpred, jTerm term)
          Add jOr separated jTerms to the provided jOrPredicate.
 void makePredicateTerms(jTerm t)
          Add jCons and jOr separated jTerms to this jPredicateTerms.
 void removePredicate(iPredicate p)
           
 void removeTerm(jTerm t)
           
 jTerm unmake()
          Creates a jCons and/or jOr separated jTerms to represent this jPredicateTerms.
 jTerm unmakePredicateTerms()
          Creates a jCons and/or jOr separated jTerms to represent this jPredicateTerms.
 
Methods inherited from class ubc.cs.JLog.Terms.jCompoundTerm
compare, consult, consultReset, copyCompoundTerm, elementAt, enumerateVariables, enumTerms, equivalence, hasTerm, internal_copy, internal_duplicate, intersectionCompoundTerm, isEmpty, isHigherPriorityOperator, makeCompoundTerm, mutateElementAt, registerUnboundVariables, registerVariables, removeAllTerms, requiresCompleteVariableState, size, subtractCompoundTerm, toString, unify, unionCompoundTerm, unmakeCompoundTerm
 
Methods inherited from class ubc.cs.JLog.Terms.jTerm
compare, copy, getName, getTerm, getValue, isConsultNeeded, toString
 
Methods inherited from class ubc.cs.JLog.Foundation.jType
getType, objectToString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

jPredicateTerms

public jPredicateTerms()

jPredicateTerms

protected jPredicateTerms(java.util.Vector t)
Method Detail

addTerm

public void addTerm(jTerm t)
Overrides:
addTerm in class jCompoundTerm

removeTerm

public void removeTerm(jTerm t)
Overrides:
removeTerm in class jCompoundTerm

addPredicate

public void addPredicate(iPredicate p)

removePredicate

public void removePredicate(iPredicate p)

duplicate

public jTerm duplicate(jVariable[] vars)
Description copied from class: jTerm
Creates a complete and entirely independant duplicate of this term. User should call only for terms for which registerVariables has already been invoked. Within duplicate, any other calls to duplicate should pass along the same vars array produced by registerVariables since the same duplication path previously taken by registerVariables should be taken by duplicate. This call is designed only for terms which belong to rules and are templates for instantiation. Any variables in the term should be unbound. As implied by the modification restrictions on registerVariables, terms and their children cannot change (especially during call!)

Specified by:
duplicate in interface iTerm
Overrides:
duplicate in class jCompoundTerm
Parameters:
vars - The user passes in a duplicate of the variable vector produced from the previous call to registerVariables. vars is produced from the jVariableVector by creating a single duplicate variable for each variable. Since this is created in the same order as the registerVariables, it is now efficient for jVariables to return their unique duplicate.
Returns:
jTerm which is an instantiated duplicate of this term.

copy

public jTerm copy(jVariableRegistry vars)
Description copied from class: jTerm
Internal member function which creates a copy of this term. This member function is designed to duplicate a term, but without the restrictions of the duplicate function. Should only be invoked by copy() or other copy(vars). Should only invoke other copy(vars) functions. Bound variables should return a copy of the bound term.

Specified by:
copy in interface iTerm
Overrides:
copy in class jCompoundTerm
Parameters:
vars - The registry of variables and their duplicates. Initially this is empty. As variables generate copies, they add themselves and their copy to the jVariableRegistry, and this is output from the function call. Any further calls with the same vars ensures that the same variable (in a different term) returns the same copy.
Returns:
jTerm which is an instantiated copy of this term.

addGoals

public void addGoals(jGoal g,
                     jVariable[] vars,
                     iGoalStack goals)

addGoals

public void addGoals(jGoal g,
                     iGoalStack goals)

getStartingSymbol

protected java.lang.String getStartingSymbol()
Overrides:
getStartingSymbol in class jCompoundTerm

getEndingSymbol

protected java.lang.String getEndingSymbol()
Overrides:
getEndingSymbol in class jCompoundTerm

make

public void make(jTerm t)
Makes this a representation of the provided jTerm, which may include conjunction and disjunction operators. Invokes makePredicateTerms.

Specified by:
make in interface iMakeUnmake
Overrides:
make in class jCompoundTerm
Parameters:
t - jTerm using jCons to separate terms.

makePredicateTerms

public void makePredicateTerms(jTerm t)
Add jCons and jOr separated jTerms to this jPredicateTerms.

Parameters:
t - jTerm using jCons and/or jOr to separate terms.

makeOrPredicateTerms

protected void makeOrPredicateTerms(jOrPredicate orpred,
                                    jTerm term)
Add jOr separated jTerms to the provided jOrPredicate.

Parameters:
orpred - The jOrPredicate to add the jOr separated jTerms to.
term - jTerm using jOr to separate terms.

makeConsPredicateTerms

protected void makeConsPredicateTerms(jTerm term)
Add jCons separated jTerms to this jPredicateTerms instance.

Parameters:
term - jTerm using jOr to separate terms.

unmake

public jTerm unmake()
Creates a jCons and/or jOr separated jTerms to represent this jPredicateTerms. Invokes unmakePredicateTerms to perform work.

Specified by:
unmake in interface iMakeUnmake
Overrides:
unmake in class jCompoundTerm
Returns:
jTerm using jCons and jOr to separate terms. Duplicates this jPredicateTerms.

unmakePredicateTerms

public jTerm unmakePredicateTerms()
Creates a jCons and/or jOr separated jTerms to represent this jPredicateTerms.

Returns:
jTerm using jCons and jOr to separate terms. Duplicates this jPredicateTerms.