|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.nyu.cascade.ir.expr.AbstractExpressionFactory<Int,Bool,StateT>
Int
- The underlying encoding of integer valuesBool
- The underlying encoding of boolean valuesStateT
- The program state type in the underlying encodingpublic abstract class AbstractExpressionFactory<Int,Bool,StateT extends Type<StateT>>
An abstract implementation of the IExpressionFactory
interface,
with convenience implementations of several methods.
Field Summary | |
---|---|
protected static String |
FUN_ALLOCATED
An interpreted function with the following intended meaning: allocated(p,n) is true if the memory region [p,p+n] is a contiguously allocated block of memory. |
Constructor Summary | |
---|---|
protected |
AbstractExpressionFactory(ExpressionManager exprManager)
|
Method Summary | |
---|---|
Bool |
castToBoolean(Int expr)
Returns a boolean expression representing the integer value expr , according to the conversion rule of the underlying
encoding. |
Int |
castToInteger(Bool bool)
Returns an integer expression representing the boolean value bool , according to the conversion rule of the underlying
encoding. |
Int |
decr(Int expr)
Returns an integer expression representing the integer expr
minus one. |
Int |
functionCall(String name,
Iterable<Int> args)
Returns an integer expression representing the interpretation of a call to function name , with variable argument list args . |
Int |
functionCall(String name,
Iterator<Int> args)
Returns an integer expression representing the interpretation of a call to function name , with variable argument list args . |
Int |
functionCall(String name,
List<Int> args)
Returns an integer expression representing the interpretation of a call to function name , with variable argument list args . |
ImmutableSet<? extends Expression<BooleanType>> |
getAssumptions()
Get logical assumptions used in the underlying encoding. |
ExpressionManager |
getExpressionManager()
Returns the IExpressionManager object used in the underlying
expression encoding. |
Expression<StateT> |
getInitialState()
Default implementation: a variable of type StateT. |
Int |
incr(Int expr)
Returns an integer expression representing the integer expr
plus one. |
Bool |
integerAnd(Int lhs,
Int rhs)
Returns a boolean expression representing the logical AND of the two integer arguments, when converted to boolean expressions. |
Bool |
integerNot(Int e)
Returns a boolean expression representing the logical negation of the integer argument, when converted to a boolean expression. |
Bool |
integerOr(Int lhs,
Int rhs)
Returns a boolean expression representing the logical OR of the two integer arguments, when converted to boolean expressions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.nyu.cascade.ir.expr.ExpressionFactory |
---|
allocated, and, assign, bitwiseAnd, deref, eq, evalBoolean, ff, getStateType, greaterThan, greaterThanOrEqual, ifThenElse, indexArray, indexArray, integerConstant, integerVar, lessThan, lessThanOrEqual, minus, neq, nor, not, one, or, plus, tt, type, unknown, variable, zero |
Field Detail |
---|
protected static final String FUN_ALLOCATED
Constructor Detail |
---|
protected AbstractExpressionFactory(ExpressionManager exprManager)
Method Detail |
---|
public Bool castToBoolean(Int expr) throws ExpressionFactoryException
expr
, according to the conversion rule of the underlying
encoding.
Default implementation: following the C convention, an expression
expr
has the boolean value true
iff. it is not
equal to the return value of zero()
.
castToBoolean
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Int castToInteger(Bool bool) throws ExpressionFactoryException
bool
, according to the conversion rule of the underlying
encoding.
Default implementation: true maps to the return value of one()
and false maps to the return value of zero()
.
castToInteger
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Int decr(Int expr) throws ExpressionFactoryException
expr
minus one.
Default implementation: encoding using minus()
and
one()
.
decr
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Int functionCall(String name, List<Int> args) throws ExpressionFactoryException
name
, with variable argument list args
.
Default implementation: interprets the allocated
annotation
using allocated()
. Sub-classes overriding this method should
call super()
to maintain this behavior.
functionCall
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Int functionCall(String name, Iterable<Int> args) throws ExpressionFactoryException
ExpressionFactory
name
, with variable argument list args
.
functionCall
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Int functionCall(String name, Iterator<Int> args) throws ExpressionFactoryException
ExpressionFactory
name
, with variable argument list args
.
functionCall
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public ImmutableSet<? extends Expression<BooleanType>> getAssumptions() throws ExpressionFactoryException
x
, y
, and z
are represented as
indices into an array, then getAssumptions()
may return
{ x ≠ y, x ≠ z, y ≠ z }
.
Default implementation: an empty set of assumptions.
getAssumptions
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public ExpressionManager getExpressionManager()
ExpressionFactory
IExpressionManager
object used in the underlying
expression encoding.
getExpressionManager
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
public Expression<StateT> getInitialState() throws ExpressionFactoryException
getInitialState
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Int incr(Int expr) throws ExpressionFactoryException
expr
plus one.
Default implementation: encoding using plus()
and
one()
.
incr
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Bool integerAnd(Int lhs, Int rhs) throws ExpressionFactoryException
and()
and
castToBoolean()
.
integerAnd
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Bool integerNot(Int e) throws ExpressionFactoryException
not()
and
castToBoolean()
.
integerNot
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
public Bool integerOr(Int lhs, Int rhs) throws ExpressionFactoryException
or()
and
castToBoolean()
.
integerOr
in interface ExpressionFactory<Int,Bool,StateT extends Type<StateT>>
ExpressionFactoryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |