de.cau.cs.kieler.krep.compiler.ceq
Class State

java.lang.Object
  extended by de.cau.cs.kieler.krep.compiler.ceq.State
All Implemented Interfaces:
Scope

public class State
extends Object
implements Scope

A state in a Safe State Machine, consisting of a name, a flag whether this is an initial state, and outgoing transitions. Transitions are either weak or strong aborts, normal termination is not supported.

Rating yellow
(2010-02-05) review by cmot, msp, tam

Constructor Summary
State(String n, boolean initial)
           
 
Method Summary
 void add(Automaton ssm)
          
 void add(Equation eq)
          
 void add(LinkedList<Variable> vars)
          
 void addEq(LinkedList<Equation> eq)
          
 void addSAbort(Transition t)
          Add outgoing strong abort.
 void addWAbort(Transition t)
          Add outgoing weak abort.
 LinkedList<AbstractInstruction> compileBody()
           
 LinkedList<AbstractInstruction> compileCtrl(String ssm, HashMap<String,State> states, int prioOffset)
           
 LinkedList<AbstractInstruction> compileInit(boolean setInputs, boolean setOutputs, int prioOffset)
           
 DepGraph getDepGraph()
           
 LinkedList<Variable> getInputs()
           
 int getMaxPrio()
           
 String getName()
           
 LinkedList<Variable> getOutputs()
           
 boolean isInitial()
           
 void propagateConst()
          propagate constant values .
 void replace(HashMap<String,Variable> equiv)
           
 void setIO()
           
 void simplify()
          simplify contained equations.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

public State(String n,
             boolean initial)
Parameters:
n - unique name of the state
initial - true if this is an initial state
Method Detail

addSAbort

public void addSAbort(Transition t)
Add outgoing strong abort.

Parameters:
t - new transitions

addWAbort

public void addWAbort(Transition t)
Add outgoing weak abort.

Parameters:
t - new transitions

toString

public String toString()
Overrides:
toString in class Object

add

public void add(LinkedList<Variable> vars)

Specified by:
add in interface Scope
Parameters:
vars - local variables

add

public void add(Automaton ssm)

Specified by:
add in interface Scope
Parameters:
ssm - additional automaton

add

public void add(Equation eq)

Specified by:
add in interface Scope
Parameters:
eq - additional equation.

addEq

public void addEq(LinkedList<Equation> eq)

Specified by:
addEq in interface Scope
Parameters:
eq - additional equations.

propagateConst

public void propagateConst()
propagate constant values .


simplify

public void simplify()
simplify contained equations.


getName

public String getName()
Returns:
name of the state

isInitial

public boolean isInitial()
Returns:
true if the state is an initial state.

compileBody

public LinkedList<AbstractInstruction> compileBody()
Returns:
klp code that implements the body of the state

setIO

public void setIO()

compileCtrl

public LinkedList<AbstractInstruction> compileCtrl(String ssm,
                                                   HashMap<String,State> states,
                                                   int prioOffset)
Parameters:
ssm - the name of the ssm that constains this state
states - all states in the fsm
prioOffset - minimal priority to use
Returns:
klp code that implemenst the controller, ie, checks for abortions

compileInit

public LinkedList<AbstractInstruction> compileInit(boolean setInputs,
                                                   boolean setOutputs,
                                                   int prioOffset)
Parameters:
setInputs - initialize inputs?
setOutputs - initialize outputs?
prioOffset - minimal priority to use
Returns:
klp instructions to initialize the used registers

getMaxPrio

public int getMaxPrio()
Returns:
maximal used priority

getInputs

public LinkedList<Variable> getInputs()
Returns:
all input signals of the state

getOutputs

public LinkedList<Variable> getOutputs()
Returns:
all output signals of the state

getDepGraph

public DepGraph getDepGraph()
Returns:
dependency graph

replace

public void replace(HashMap<String,Variable> equiv)
Parameters:
equiv - list of equivalent variables