ConForM.CoopnTools.CoKer.CoopnSem.LogicEngine
Class LogicEngine

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CoopnSem.LogicEngine.LogicEngine

public abstract class LogicEngine
extends java.lang.Object

Prolog-like logic engine.


Field Summary
protected  CoopnEnv env
           
 
Constructor Summary
LogicEngine(CoopnEnv env)
          Constructor for a logic engine.
 
Method Summary
abstract  void abort()
          Stop the call, i.e. cut the query.
abstract  boolean assert(LogicTerm clause)
          Assert a clause in the engine.
abstract  LogicUnification call(LogicGoal query)
          Ask a query to the engine.
abstract  boolean consult(java.lang.String filename)
          Consult a file.
 void dispose()
          End of the logic engine.
static LogicEngine getLogicEngine(CoopnEnv env)
          Get a logic engine.
abstract  void interrupt()
          Interrupt a call or redo, if possible.
abstract  LogicUnification redo()
          Redo the call, i.e. continues the query.
abstract  boolean retract(LogicTerm clause)
          Retract a clause in the engine.
abstract  java.lang.String signature()
          Signature of a logic engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

protected CoopnEnv env
Constructor Detail

LogicEngine

public LogicEngine(CoopnEnv env)
            throws java.lang.IllegalStateException
Constructor for a logic engine.
Throws:
java.lang.IllegalStateException - this kind of machine is unavailable on this platform.
Method Detail

dispose

public void dispose()
End of the logic engine.

signature

public abstract java.lang.String signature()
Signature of a logic engine.
Returns:
a short string describing the nature of the logic engine.

assert

public abstract boolean assert(LogicTerm clause)
Assert a clause in the engine.
Parameters:
clause - the clause to assert; cannot be null
Returns:
true if the assert is OK, false else.

retract

public abstract boolean retract(LogicTerm clause)
Retract a clause in the engine.
Parameters:
clause - the clause to retract; cannot be null
Returns:
true if the retract is OK, false else.

call

public abstract LogicUnification call(LogicGoal query)
Ask a query to the engine.
Parameters:
query - the query; cannot be null
Returns:
null iff the query evaluates to false; an object representing the unification if the query evaluates to true.

redo

public abstract LogicUnification redo()
Redo the call, i.e. continues the query. If no call are in action, evaluates to false.
Returns:
null iff the query evaluates to false; an object representing the unification if the query evaluates to true.

abort

public abstract void abort()
Stop the call, i.e. cut the query.

interrupt

public abstract void interrupt()
Interrupt a call or redo, if possible.

consult

public abstract boolean consult(java.lang.String filename)
Consult a file.
Parameters:
filename - the name of the file; cannot be null.
Returns:
true if the consult is OK, false else.

getLogicEngine

public static LogicEngine getLogicEngine(CoopnEnv env)
Get a logic engine. Factory method; the returned engine is supposed to be well-suited for the underlying exectution platform.
Returns:
a logic engine, or null iff not suitable logic engine are found for the underlying platform.