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

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

public class PreExpression
extends Expression

Lustre previous expression.

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
PreExpression(String name, Expression e)
           
 
Method Summary
 Equation declock(String basename, int stage, String c, LinkedList<Equation> aux, Program prog)
          remove all clock operators inside.
 Expression extractPre(HashMap<String,Expression> eqs)
           
 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.
 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreExpression

public PreExpression(String name,
                     Expression e)
Parameters:
name - unique name of the expression
e - expression which previous value is computed
Method Detail

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.

extractPre

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