Pro_Trail 1.4
java.lang.Objectio.github.JalogTeam.jalog.Pro_Trail
public class Pro_Trail
Class Pro_Trail implements the trail concept of Prolog. It
stores information about variable bindings and
supports clearing those bindings on backtrack.
Logically the trail is a stack of variable references. When a variable is bound to a value or another variable a pointer to the variable is pushed to the trail. On backtrack variables are popped from the trail and the binding of each popped variable is cleared.
| Method Summary | |
|---|---|
public void
|
mark(Pro_TrailMark Mark)
Updates the parameter Mark to indicate which bindings shall be
cleared on a possible backtrack.
|
public void
|
append(Pro_Term pn)
The method pushes a variable reference to the trail. |
public void
|
backtrack(Pro_TrailMark Mark)
Pops variables from the trail and clears the binding of each popped variable. |
public void
|
dump(String header)
Dumps the contents of the trail (for debugging). |
| Method Detail |
|---|
public void mark(Pro_TrailMark Mark)
Updates the parameter Mark to indicate which bindings shall
be cleared on a possible backtrack.
When backtrack is called with this Mark the
variable bindings pushed to the trail after this call are cleared.
Mark - must not be null. This is updated to
indicate the current top of the trail.
public void append(Pro_Term pn)
The method pushes a variable reference to the trail.
It is usually necessary to push all variables to the trail after they are bound to another variable or a value.
pn - must not be null; the variable that was
bound.
public void backtrack(Pro_TrailMark Mark)
Pops variables from the trail and clears the binding of each
popped variable. The parameter Mark indicates which variables
are to be popped: those variables that were pushed to the trail after the
object Mark was updated.
Mark - must not be null. Indicates which
variables are to be popped.
public void dump(String header)
header and then the contents of the trail.
header - the header to be printed.