ubc.cs.JLog.Terms.Goals
Class jPredicateGoal

java.lang.Object
  extended by ubc.cs.JLog.Foundation.jGoal
      extended by ubc.cs.JLog.Terms.Goals.jPredicateGoal
All Implemented Interfaces:
iName, iNameArity

public final class jPredicateGoal
extends jGoal


Field Summary
protected  jGoal end_goal
           
 jCompoundTerm input_goal
           
 jCompoundTerm rule_goal
           
protected  int rule_number
           
protected  jRuleDefinitions rules
           
protected static int STARTING_RULE
           
 jUnifiedVector unified
           
 
Fields inherited from class ubc.cs.JLog.Foundation.jGoal
next
 
Constructor Summary
jPredicateGoal(jRuleDefinitions rs, jCompoundTerm in)
           
 
Method Summary
 int getArity()
          Returns the arity of this instance.
 java.lang.String getName()
          Returns the name of this instance.
 int getNextRuleNumber()
           
 int getRuleNumber()
           
 jRuleDefinitions getRules()
           
protected  void internal_remove(iGoalStack goals)
          Make a rule on the proved stack clean up children on the goal stack.
 void internal_restore(iGoalStack goals)
          Combines internal_remove with a full restart and resoration of any previous variable state.
 boolean prove(iGoalStack goals, iGoalStack proved)
          Attempt to prove the goal represented by this jGoal.
 boolean retry(iGoalStack goals, iGoalStack proved)
          Attempt to prove the goal represented by this jGoal.
 void setEndGoal(jGoal goal)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STARTING_RULE

protected static final int STARTING_RULE
See Also:
Constant Field Values

rules

protected jRuleDefinitions rules

rule_number

protected int rule_number

end_goal

protected jGoal end_goal

input_goal

public jCompoundTerm input_goal

rule_goal

public jCompoundTerm rule_goal

unified

public jUnifiedVector unified
Constructor Detail

jPredicateGoal

public jPredicateGoal(jRuleDefinitions rs,
                      jCompoundTerm in)
Method Detail

setEndGoal

public final void setEndGoal(jGoal goal)

getNextRuleNumber

public final int getNextRuleNumber()

getRuleNumber

public final int getRuleNumber()

getRules

public final jRuleDefinitions getRules()

prove

public boolean prove(iGoalStack goals,
                     iGoalStack proved)
Description copied from class: jGoal
Attempt to prove the goal represented by this jGoal. Goal must not be on either stack to prove (pop off goals stack before prove call). Goal must place itself on the appropriate stack before returning. proved stack if 'proved', goals stack otherwise. Since proved doesn't pop the stack we don't need a try/catch block. Must be called at least once before calling retry.

Specified by:
prove in class jGoal
Parameters:
goals - iGoalStack containing goals yet to be proved.
proved - iGoalStack containing evaluated goals (goals that may already be proved, or awaiting their child goals to be proved).
Returns:
boolean is true if this goal ended up on proved, false otherwise.

retry

public boolean retry(iGoalStack goals,
                     iGoalStack proved)
Description copied from class: jGoal
Attempt to prove the goal represented by this jGoal. Goal must not be on either stack to retry (pop off proved stack before retry call). Goal must place itself on the goal stack, and normally need not pop either stack. Since retry doesn't pop the stack we don't need a try/catch block.

Specified by:
retry in class jGoal
Parameters:
goals - iGoalStack containing goals yet to be proved.
proved - iGoalStack containing evaluated goals (goals that may already be proved, or awaiting their child goals to be proved).
Returns:
boolean is true if the prover should attempt a prove on this goal, false otherwise.

internal_remove

protected final void internal_remove(iGoalStack goals)
Description copied from class: jGoal
Make a rule on the proved stack clean up children on the goal stack. Should be called from within retry, and should rely on retry to adjust the proved stack. this remains on proved stack.

Overrides:
internal_remove in class jGoal
Parameters:
goals - iGoalStack containing goals yet to be proved.

internal_restore

public final void internal_restore(iGoalStack goals)
Description copied from class: jGoal
Combines internal_remove with a full restart and resoration of any previous variable state. May be called by other goals, such as a jCutGoal. this is still located on proved stack.

Overrides:
internal_restore in class jGoal
Parameters:
goals - iGoalStack containing goals yet to be proved.

getName

public java.lang.String getName()
Description copied from interface: iName
Returns the name of this instance.

Returns:
String containing name of this instance.

getArity

public int getArity()
Description copied from interface: iNameArity
Returns the arity of this instance.

Returns:
int whose value is the arity of this instance.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object