Prolog Cafe v1.2

jp.ac.kobe_u.cs.prolog.lang
Class Trail

java.lang.Object
  extended by jp.ac.kobe_u.cs.prolog.lang.Trail
All Implemented Interfaces:
java.io.Serializable

public class Trail
extends java.lang.Object
implements java.io.Serializable

Trail stack.
The class Trail represents a trail stack.
Entries pushed to this trail stack must implement the Undoable interface.

See Also:
Undoable, Serialized Form

Field Summary
protected  Undoable[] buffer
          An array of Undoable entries.
protected  Prolog engine
          Holds the Prolog engine that this Trail belongs to.
protected  int maxContents
          Maximum size of enties.
protected  int top
          the top index of this Trail.
 
Constructor Summary
Trail(Prolog _engine)
          Constructs a new trail stack.
Trail(Prolog _engine, int n)
          Constructs a new trail stack with the given size.
 
Method Summary
protected  void deleteAll()
          Discards all entries.
 boolean empty()
          Tests if this stack has no entry.
 void init()
          Discards all entries.
 int max()
          Returns the value of maxContents.
 Undoable pop()
          Pops an entry from this Trail.
 void push(Undoable t)
          Pushs an entry to this Trail.
 void show()
          Shows the contents of this Trail.
 int top()
          Returns the value of top.
 void unwind(int i)
          Unwinds all entries after the value of i.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxContents

protected int maxContents
Maximum size of enties. Initial size is 20000.


buffer

protected Undoable[] buffer
An array of Undoable entries.


top

protected int top
the top index of this Trail.


engine

protected Prolog engine
Holds the Prolog engine that this Trail belongs to.

Constructor Detail

Trail

public Trail(Prolog _engine)
Constructs a new trail stack.


Trail

public Trail(Prolog _engine,
             int n)
Constructs a new trail stack with the given size.

Method Detail

init

public void init()
Discards all entries.


push

public void push(Undoable t)
Pushs an entry to this Trail.


pop

public Undoable pop()
Pops an entry from this Trail.


deleteAll

protected void deleteAll()
Discards all entries.


empty

public boolean empty()
Tests if this stack has no entry.


max

public int max()
Returns the value of maxContents.

See Also:
maxContents

top

public int top()
Returns the value of top.

See Also:
top

unwind

public void unwind(int i)
Unwinds all entries after the value of i.


show

public void show()
Shows the contents of this Trail.


Prolog Cafe v1.2

Copyright (C) 1997-2008 M.BANBARA and N.TAMURA