ua.gradsoft.termware
Class TransformationContext

java.lang.Object
  extended by ua.gradsoft.termware.TransformationContext

public class TransformationContext
extends Object

Context of term transformation.


Constructor Summary
TransformationContext()
          Creates a new instance of TransformationContext
 
Method Summary
 Substitution getCurrentSubstitution()
          return substitutions for currently-evaluated term.
 IEnv getEnv()
          return environment for writing output and error messages.
 boolean isChanged()
           
 boolean isStop()
          get stop flag for currently-evaluated term.
 Substitution newCurrentSubstitution()
           
 void setChanged(boolean changed)
           
 void setEnv(IEnv env)
          set environment
 void setStop(boolean stop)
          set current stop flag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformationContext

public TransformationContext()
Creates a new instance of TransformationContext

Method Detail

getCurrentSubstitution

public Substitution getCurrentSubstitution()
return substitutions for currently-evaluated term.
Used for manipulation with substitutions of current rule inside actions (check and set methods). example:
class MyFacts extends DefaultFacts {
    ..
   void setPropositionalVariabel(TransformationContext ctx, Term t,int x) throws TermWareException
   {
    if (!t.isX) {
        throw new AssertException("setPropositionalVariable must receive propositional variable as argument");
    }
    Substitution s=ctx.getCurrentSubstitution();
      if (s!=null) s.put(t,ITermFactory.createInt(x));
   }
    
in multi-threading environment can refer to thread-local storage.


newCurrentSubstitution

public Substitution newCurrentSubstitution()

isStop

public boolean isStop()
get stop flag for currently-evaluated term. (strategy must stop evaluation of this term after setting stop flag to true)


setStop

public void setStop(boolean stop)
set current stop flag


isChanged

public boolean isChanged()

setChanged

public void setChanged(boolean changed)

getEnv

public IEnv getEnv()
return environment for writing output and error messages.


setEnv

public void setEnv(IEnv env)
set environment