kites.visual
Class StepRewrite

java.lang.Object
  extended by kites.visual.StepRewrite

public class StepRewrite
extends java.lang.Object

This class handles doing a step in the interpretation


Field Summary
private  boolean firstStep
           
private  ASTNode instanceTree
           
private  int mode
           
private  TRSFile rulelist
           
private  java.util.HashMap<java.lang.String,java.lang.Integer> signature
           
private  int strategy
           
private  InterpreterWindow wnd
           
 
Constructor Summary
StepRewrite(TRSFile rulelist, java.util.HashMap<java.lang.String,java.lang.Integer> signature, InterpreterWindow wnd)
          Create a new instance of this class.
 
Method Summary
 ASTNode getInstanceTree()
          Get the current instance.
 boolean isStepPossible()
          Determine whether another interpretative step using the rules in the current mode and strategy is possible.
 void parseInstance()
          Parse the instance in the interpreter window.
 void run()
          Perform a step in the interpretation.
 void setFirst()
          Abort the current interpretation and reset.
 void setMode(int mode)
          Set the interpretation mode.
 void setStrategy(int strategy)
          Set the interpretation strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

firstStep

private boolean firstStep

rulelist

private TRSFile rulelist

instanceTree

private ASTNode instanceTree

mode

private int mode

strategy

private int strategy

signature

private java.util.HashMap<java.lang.String,java.lang.Integer> signature

wnd

private InterpreterWindow wnd
Constructor Detail

StepRewrite

public StepRewrite(TRSFile rulelist,
                   java.util.HashMap<java.lang.String,java.lang.Integer> signature,
                   InterpreterWindow wnd)
Create a new instance of this class.

Parameters:
rulelist - the rulelist the interpretation will be based on
signature - the signature of the rulelist
wnd - the interpreter window the results shall be displayed in
Method Detail

setFirst

public void setFirst()
Abort the current interpretation and reset.


setMode

public void setMode(int mode)
Set the interpretation mode.

Parameters:
mode - the mode from kites.logic.Decomposition
See Also:
Decomposition

setStrategy

public void setStrategy(int strategy)
Set the interpretation strategy. Only applicable/used when in program interpretation mode.

Parameters:
strategy - the strategy from kites.logic.Decomposition
See Also:
Decomposition

isStepPossible

public boolean isStepPossible()
Determine whether another interpretative step using the rules in the current mode and strategy is possible.

Returns:
true if a step is possible, false otherwise

run

public void run()
         throws SyntaxErrorException,
                DecompositionException,
                NoRewritePossibleException,
                org.antlr.runtime.RecognitionException,
                NoChildrenException,
                NodeException
Perform a step in the interpretation. In the first step, the instance in the interpreter window is fetched and parsed.

Throws:
SyntaxErrorException - if an error in the tree was found
DecompositionException - if an error with the decomposition is found
NoRewritePossibleException - if no rewrite is possible
org.antlr.runtime.RecognitionException - if there was a lexer or parser error (only thrown during first step)
NoChildrenException - if an error in the tree was found
NodeException - if an error in a node was found

parseInstance

public void parseInstance()
                   throws org.antlr.runtime.RecognitionException,
                          SyntaxErrorException,
                          NodeException
Parse the instance in the interpreter window. If an interpretation is already underway, it will be aborted and the object reset.

Throws:
org.antlr.runtime.RecognitionException - If a lexer/parser error was encountered
SyntaxErrorException - If an error in the tree structure was encountered
NodeException - If an error in a node was encountered

getInstanceTree

public ASTNode getInstanceTree()
Get the current instance. If one or more steps in the interpretation was performed, this is the transformed/interpreted instance, not the original one.

Returns:
the instance