public class ComponentBuilder
extends java.lang.Object
function and
node keywords, which have slightly different semantics. Like the name suggests, the
output(s) of a function should be a non-temporal combination of its inputs. That is, a
function cannot use the ->, pre, merge, when, condact, or
activate operators. A function is also not allowed to call a node, only other functions.
In Lustre terms, functions are stateless.
In Kind 2, these restrictions extend to the contract attached to the function, if any. Note that besides the ones mentioned here, no additional restrictions are enforced on functions compared to nodes.
| Constructor and Description |
|---|
ComponentBuilder(java.lang.String id)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAssertion(Expr assertion)
add an assertion
|
void |
addEquation(IdExpr var,
Expr expr)
add an equation
|
void |
addEquation(java.util.List<IdExpr> vars,
Expr expr)
add an equation
|
void |
addProperty(Expr expr)
add a property for Kind2 to check
|
void |
addProperty(java.lang.String name,
Expr expr)
add a property for Kind2 to check
|
IdExpr |
createConstInput(java.lang.String name,
Type type)
add a constant input parameter
|
IdExpr |
createLocalConst(java.lang.String name,
Expr expr)
define a local constant
|
IdExpr |
createLocalConst(java.lang.String name,
Type type)
define a local symbolic constant
|
IdExpr |
createLocalConst(java.lang.String name,
Type type,
Expr expr)
define a local constant
|
IdExpr |
createLocalVar(java.lang.String name,
Type type)
declare a local variable
|
IdExpr |
createVarInput(java.lang.String name,
Type type)
add a variable input parameter
|
IdExpr |
createVarOutput(java.lang.String name,
Type type)
add a variable output parameter
|
void |
setContractBody(ContractBodyBuilder contractBodyBuilder)
set the contract body for the component
|
public ComponentBuilder(java.lang.String id)
id - name of the componentpublic IdExpr createConstInput(java.lang.String name, Type type)
name - name of the input parametertype - type of the input parameterpublic IdExpr createVarInput(java.lang.String name, Type type)
name - name of the input parametertype - type of the input parameterpublic IdExpr createVarOutput(java.lang.String name, Type type)
name - name of the output parametertype - type of the output parameterpublic void setContractBody(ContractBodyBuilder contractBodyBuilder)
contractBodyBuilder - a builder for the contract bodypublic IdExpr createLocalConst(java.lang.String name, Type type)
name - name of the local constanttype - type of the local constantpublic IdExpr createLocalConst(java.lang.String name, Expr expr)
name - name of the local constantexpr - definition of the local constantpublic IdExpr createLocalConst(java.lang.String name, Type type, Expr expr)
name - name of the local constanttype - type of the local constantexpr - definition of the local constantpublic IdExpr createLocalVar(java.lang.String name, Type type)
name - name of the local variabletype - type of the local variablepublic void addEquation(IdExpr var, Expr expr)
var - lhs of the equationexpr - rhs of the equationpublic void addEquation(java.util.List<IdExpr> vars, Expr expr)
vars - lhs of the equationexpr - rhs of the equationpublic void addProperty(java.lang.String name,
Expr expr)
name - name of the propertyexpr - the property to checkpublic void addProperty(Expr expr)
expr - the property to checkpublic void addAssertion(Expr assertion)
assertion - the assertion to add