Kernel Prolog with Fluent based Builtins

tarau.jinni
Class Fluent

java.lang.Object
  |
  +--tarau.jinni.Term
        |
        +--tarau.jinni.Nonvar
              |
              +--tarau.jinni.SystemObject
                    |
                    +--tarau.jinni.Fluent
Direct Known Subclasses:
MultiVar, Sink, Source

public class Fluent
extends SystemObject

A Fluent is a Jinni Object which has its own state, subject to changes over time.


Field Summary
private  boolean persistent
           
 
Fields inherited from class tarau.jinni.SystemObject
ctr, ordinal
 
Fields inherited from class tarau.jinni.Term
CONST, INT, JAVA, REAL, VAR
 
Constructor Summary
Fluent(Prog p)
           
 
Method Summary
 boolean getPersistent()
          returns true if this Fluent is persistent, false otherwise
 void setPersistent(boolean persistent)
          Dynamically sets the persistence status of this Fluent.
 void stop()
           
protected  void trailMe(Prog p)
          Adds this Fluent to the parent Solver's trail, which will eventually call the undo method of the Fluent on backtracking.
protected  void undo()
          applies a non-persistent Fluent's stop() method on backtracking
 
Methods inherited from class tarau.jinni.SystemObject
bind_to, getArity, name, toString
 
Methods inherited from class tarau.jinni.Nonvar
eq, listify, unify_to
 
Methods inherited from class tarau.jinni.Term
action, charsToString, copy, exec, exec, fromString, getKey, isBuiltin, isClause, matches, matching_copy, numbervars, pprint, pprint, reaction, ref, stringToChars, toChars, toClause, token, toObject, toTerm, toUnquoted, unify, varsOf
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

persistent

private boolean persistent
Constructor Detail

Fluent

public Fluent(Prog p)
Method Detail

setPersistent

public void setPersistent(boolean persistent)
Dynamically sets the persistence status of this Fluent. A persistent Fluent will not have its stop method outomatically called upon backtracking. A typical example would be a file or socket handle saved to the database to be reused after backtracking.

getPersistent

public boolean getPersistent()
returns true if this Fluent is persistent, false otherwise

trailMe

protected void trailMe(Prog p)
Adds this Fluent to the parent Solver's trail, which will eventually call the undo method of the Fluent on backtracking.

stop

public void stop()

undo

protected void undo()
applies a non-persistent Fluent's stop() method on backtracking
Overrides:
undo in class Term

Kernel Prolog with Fluent based Builtins