de.cau.cs.kieler.krep.compiler.lustre
Class VarAccessExpression

java.lang.Object
  extended by de.cau.cs.kieler.krep.compiler.lustre.Expression
      extended by de.cau.cs.kieler.krep.compiler.lustre.VarAccessExpression

public class VarAccessExpression
extends Expression

Implement the possible immediate access to a Lustre variable.

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

Field Summary
 
Fields inherited from class de.cau.cs.kieler.krep.compiler.lustre.Expression
STAGE_CURRENT, STAGE_INIT, STAGE_NEW, STAGE_WHEN
 
Constructor Summary
VarAccessExpression(String name)
           
VarAccessExpression(Variable v)
           
 
Method Summary
 Equation declock(String basename, int stage, String c, LinkedList<Equation> aux, Program prog)
          remove all clock operators inside.
 boolean equals(Object o)
           
 Expression extractPre(HashMap<String,Expression> eqs)
           
 int hashCode()
          
 ClockList inferClock(HashMap<String,Variable> env)
          Compute clock on which this expression runs.
protected  void inferType()
          compute types and set type member recursively in all sub-expressions.
 boolean isAtom()
           
 Expression liftClock()
           
 void propagateClock(ClockList l)
          Propagate to each expression, on which clock it runs.
 Expression propagatePre(HashMap<String,Expression> eqs)
          make sure only simple variables are inside of pre operators.
 void setClock(String clock)
           
 String toString()
           
 
Methods inherited from class de.cau.cs.kieler.krep.compiler.lustre.Expression
addClock, getClock, getInit, getName, getType, setClock, setInit, setName, setType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VarAccessExpression

public VarAccessExpression(String name)
Parameters:
name - name of the read variable

VarAccessExpression

public VarAccessExpression(Variable v)
Parameters:
v - variable to read
Method Detail

setClock

public void setClock(String clock)
Parameters:
clock - on which the variable shall run

toString

public String toString()
Overrides:
toString in class Object

propagatePre

public Expression propagatePre(HashMap<String,Expression> eqs)
Description copied from class: Expression
make sure only simple variables are inside of pre operators.

Specified by:
propagatePre in class Expression
Parameters:
eqs - additionally added equations
Returns:
simplified expression

isAtom

public boolean isAtom()
Specified by:
isAtom in class Expression
Returns:
true if expression does not contain any subexpressions

inferType

protected void inferType()
                  throws TypeException
Description copied from class: Expression
compute types and set type member recursively in all sub-expressions.

Specified by:
inferType in class Expression
Throws:
TypeException - thrown if any type problem occurs

inferClock

public ClockList inferClock(HashMap<String,Variable> env)
                     throws ClockException
Description copied from class: Expression
Compute clock on which this expression runs.

Specified by:
inferClock in class Expression
Parameters:
env - list of all defined variables
Returns:
list of all sub-clocks
Throws:
ClockException - thrown if any clock error occurs

propagateClock

public void propagateClock(ClockList l)
Description copied from class: Expression
Propagate to each expression, on which clock it runs. The clock vector should be computed by inferClock before.

Specified by:
propagateClock in class Expression
Parameters:
l - clock-vector for the expression

declock

public Equation declock(String basename,
                        int stage,
                        String c,
                        LinkedList<Equation> aux,
                        Program prog)
Description copied from class: Expression
remove all clock operators inside.

Specified by:
declock in class Expression
Parameters:
basename - name of the expression, used for auxiliary expressions
stage - indicate what clock operators have already been in this equation: 0: on top level 1: beyond current 2: beyond when 3: beyond ->
c - clock
aux - additional equations
prog - program that contains the expression
Returns:
new expression, without current, ->, and when

liftClock

public Expression liftClock()
Specified by:
liftClock in class Expression
Returns:
equivalent expression with clocks lifted as much as possible.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

extractPre

public Expression extractPre(HashMap<String,Expression> eqs)
Specified by:
extractPre in class Expression
Parameters:
eqs - add auxiliary equations
Returns:
expression without multiple pres

hashCode

public int hashCode()

Overrides:
hashCode in class Object