Class BuildContext
- java.lang.Object
- 
- jadex.rules.parser.conditions.javagrammar.BuildContext
 
- 
 public class BuildContext extends java.lang.ObjectThe build context captures knowledge about conditions, variables, etc. during constraint parsing or building.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.MapbconsThe object conditions (variable -> object conditions (object condition with defining bound constraint)).protected java.util.MapboundconstraintsThe bound constraints (variable -> boundconstraint (only variable definitions, i.e.protected ObjectConditiondummyThe dummy condition (if any).protected java.util.ListlconsThe list of conditions.protected java.util.ListoconstackStack for object conditions (for checking if constraints can be generated in current context).protected BuildContextparentThe parent build context (if any).protected OAVTypeModeltmodelThe OAV type model.protected java.util.MapvariablesThe variables (name -> variable).
 - 
Constructor SummaryConstructors Constructor Description BuildContext(BuildContext parent)Create a new build context.BuildContext(ICondition condition, OAVTypeModel tmodel)Create a new build context.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCondition(ICondition condition)Add a condition to the context.voidaddVariable(Variable var)Add a variable.ObjectConditioncreateObjectCondition(OAVObjectType type, IConstraint[] constraints)Create a new object condition with the given constraints.VariablegenerateVariableBinding(ConstrainableCondition condition, java.lang.Object valuesource)Create a new variable and bind it using the given object condition and value source.VariablegenerateVariableBinding(ConstrainableCondition condition, java.lang.String name, OAVObjectType type, java.lang.Object valuesource)Create a new variable and bind it using the given object condition and value source.VariablegenerateVariableBinding(ConstrainableCondition condition, java.lang.String name, java.lang.Object valuesource)Create a new variable and bind it using the given object condition and value source.java.lang.StringgenerateVariableName()Generate a variable name.BoundConstraintgetBoundConstraint(Variable var)Get the bound constraint a variable, i.e.java.util.SetgetBoundVariables()Get the variables, which are available in this build context.java.util.ListgetConditions()Get the conditions.ConstrainableConditiongetConstrainableCondition(Variable var)Get an object condition for a variable, i.e.ConstrainableConditiongetConstrainableCondition0(Variable var)Get an object condition for a variable, i.e.ConstrainableConditiongetCurrentCondition()Get the current condition from the stack.protected BuildContextgetDefiningScope(ICondition con)Get the context in which the given condition is defined.ObjectConditiongetDummyCondition()Expressions, which are unrelated to real object conditions should be bound to the dummy condition.BuildContextgetParent()Return the parent build context (if any).protected static OAVObjectTypegetReturnType(ConstrainableCondition cond, java.lang.Object valuesource, OAVTypeModel tmodel)Get the return type of a value source.OAVTypeModelgetTypeModel()Get the OAV type model.VariablegetVariable(java.lang.String name)Get a variable.booleanhasDummyCondition()Test if a dummy condition was used in the context.voidpopCondition()Pop a condition from the stack.voidpushCondition(ConstrainableCondition con)Push a condition on the stack.
 
- 
- 
- 
Field Detail- 
lconsprotected java.util.List lcons The list of conditions.
 - 
variablesprotected java.util.Map variables The variables (name -> variable).
 - 
boundconstraintsprotected java.util.Map boundconstraints The bound constraints (variable -> boundconstraint (only variable definitions, i.e. EQUAL constraints)).
 - 
bconsprotected java.util.Map bcons The object conditions (variable -> object conditions (object condition with defining bound constraint)).
 - 
tmodelprotected OAVTypeModel tmodel The OAV type model.
 - 
dummyprotected ObjectCondition dummy The dummy condition (if any).
 - 
parentprotected BuildContext parent The parent build context (if any).
 - 
oconstackprotected java.util.List oconstack Stack for object conditions (for checking if constraints can be generated in current context).
 
- 
 - 
Constructor Detail- 
BuildContextpublic BuildContext(ICondition condition, OAVTypeModel tmodel) Create a new build context.- Parameters:
- condition- The initial condition.
 
 - 
BuildContextpublic BuildContext(BuildContext parent) Create a new build context.- Parameters:
- parent- The parent build context.
 
 
- 
 - 
Method Detail- 
getConditionspublic java.util.List getConditions() Get the conditions.
 - 
getTypeModelpublic OAVTypeModel getTypeModel() Get the OAV type model.
 - 
getConstrainableConditionpublic ConstrainableCondition getConstrainableCondition(Variable var) Get an object condition for a variable, i.e. a condition, where constraints related to the variable can be added to.- Parameters:
- var- The variable
- Returns:
- The object condition.
- Throws:
- RuntimeExcpetion- when no condition was found.
 
 - 
getConstrainableCondition0public ConstrainableCondition getConstrainableCondition0(Variable var) Get an object condition for a variable, i.e. a condition, where constraints related to the variable can be added to.- Parameters:
- var- The variable
- Returns:
- The object condition.
- Throws:
- RuntimeExcpetion- when no condition was found.
 
 - 
getBoundConstraintpublic BoundConstraint getBoundConstraint(Variable var) Get the bound constraint a variable, i.e. the value source required for obtaining the variable value from the variables object condition.- Parameters:
- var- The variable
- Returns:
- The bound constraint.
- Throws:
- RuntimeExcpetion- when no constraint was found.
 
 - 
generateVariableBindingpublic Variable generateVariableBinding(ConstrainableCondition condition, java.lang.Object valuesource) Create a new variable and bind it using the given object condition and value source.- Parameters:
- condition- The object condition.
- valuesource- The value source.
- Returns:
- The new variable.
 
 - 
generateVariableNamepublic java.lang.String generateVariableName() Generate a variable name.- Returns:
- An unused variable name.
 
 - 
generateVariableBindingpublic Variable generateVariableBinding(ConstrainableCondition condition, java.lang.String name, java.lang.Object valuesource) Create a new variable and bind it using the given object condition and value source.- Parameters:
- condition- The object condition.
- name- The variable name.
- valuesource- The value source.
- Returns:
- The new variable.
 
 - 
generateVariableBindingpublic Variable generateVariableBinding(ConstrainableCondition condition, java.lang.String name, OAVObjectType type, java.lang.Object valuesource) Create a new variable and bind it using the given object condition and value source.- Parameters:
- condition- The object condition.
- name- The variable name.
- valuesource- The value source.
- Returns:
- The new variable.
 
 - 
createObjectConditionpublic ObjectCondition createObjectCondition(OAVObjectType type, IConstraint[] constraints) Create a new object condition with the given constraints. Also adds mappings corresponding to bound constraints (if any).- Parameters:
- type- The object type.
- constraints- The constraints (if any).
 
 - 
getVariablepublic Variable getVariable(java.lang.String name) Get a variable.- Parameters:
- name- The name of the variable.
- Returns:
- The variable, if any.
 
 - 
addVariablepublic void addVariable(Variable var) Add a variable.- Parameters:
- var- The variable.
 
 - 
getDummyConditionpublic ObjectCondition getDummyCondition() Expressions, which are unrelated to real object conditions should be bound to the dummy condition. After building all constraints, the dummy condition will be removed by reassigning its constraints to a suitable object condition (respecting variable assignment order).
 - 
hasDummyConditionpublic boolean hasDummyCondition() Test if a dummy condition was used in the context.
 - 
addConditionpublic void addCondition(ICondition condition) Add a condition to the context.- Parameters:
- condition- The condition.
 
 - 
getReturnTypeprotected static OAVObjectType getReturnType(ConstrainableCondition cond, java.lang.Object valuesource, OAVTypeModel tmodel) Get the return type of a value source.- Parameters:
- valuesource- The value source.
- tmodel- The type model.
- Returns:
- The object type.
 
 - 
getParentpublic BuildContext getParent() Return the parent build context (if any).
 - 
getBoundVariablespublic java.util.Set getBoundVariables() Get the variables, which are available in this build context.
 - 
pushConditionpublic void pushCondition(ConstrainableCondition con) Push a condition on the stack.
 - 
popConditionpublic void popCondition() Pop a condition from the stack.
 - 
getCurrentConditionpublic ConstrainableCondition getCurrentCondition() Get the current condition from the stack.
 - 
getDefiningScopeprotected BuildContext getDefiningScope(ICondition con) Get the context in which the given condition is defined.
 
- 
 
-