ubc.cs.JLog.Foundation
Interface iGoalStack

All Known Subinterfaces:
iDebugGoalStack
All Known Implementing Classes:
jDebugGoalStack, jDebugProvedGoalStack, jGoalStack

public interface iGoalStack

iGoalStack is the goal stack interface. A goal stack contains items of type jGoal that typically represent either proved goals or goals that need to be proved.

Author:
Glendon Holst

Method Summary
 jGoal cut(jGoal item)
          Removes all goals above the specified item.
 boolean empty()
          Determines if the stack does not contain goals.
 jGoal peek()
          Returns the top goal of the stack, without removing that goal.
 jGoal peekn(int n)
          Returns the nth goal on the stack, without removing that goal.
 jGoal pop()
          Returns and removes the top goal of the stack.
 jGoal push(jGoal item)
          Places the provided goal item as the top element of the stack.
 

Method Detail

empty

boolean empty()
Determines if the stack does not contain goals.

Returns:
true if the stack is empty, false otherwise.

pop

jGoal pop()
Returns and removes the top goal of the stack. Do not pop an empty stack.

Returns:
the top jGoal of the stack.

peek

jGoal peek()
Returns the top goal of the stack, without removing that goal. Do not peek an empty stack.

Returns:
the top jGoal of the stack.

peekn

jGoal peekn(int n)
Returns the nth goal on the stack, without removing that goal. Do not peek an empty stack. 0 is the top element.

Returns:
the nth jGoal of the stack.

push

jGoal push(jGoal item)
Places the provided goal item as the top element of the stack.

Parameters:
item - the goal to add to the stack top.
Returns:
the top jGoal of the stack, which is the provided item.

cut

jGoal cut(jGoal item)
Removes all goals above the specified item. item becomes the top goal.

Parameters:
item - the goal to truncate the stack at. item becomes the stack top. item must be in this stack instance.
Returns:
the top jGoal of the stack, which is the provided item.