Class DecisionVariable
- java.lang.Object
-
- net.ssehub.easy.integration.common.impl.DecisionVariable
-
- All Implemented Interfaces:
IDecisionVariable,IModelElement
public class DecisionVariable extends java.lang.Object implements IDecisionVariable
Implements a decision variable (delegate).- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringATTRIBUTE_NAME_BINDING_TIMEprivate EnumLiteralbindingTimeprivate IDecisionVariablevalueprivate DecisionVariableDeclarationvariable
-
Constructor Summary
Constructors Constructor Description DecisionVariable(java.lang.String name, IDatatype type, java.lang.String defaultValue, Project parent)Creates a new decision variable.DecisionVariable(DecisionVariableDeclaration variable, IDecisionVariable value)Creates a decision variable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBindingTime()Returns the binding time of the variable.(package private) AttributegetBindingTimeAttribute()Returns the binding time attribute if there is any.java.lang.StringgetDefaultValue()Returns the default value of the variable as specified as part of the variable declaration in the underlying IVML model.DecisionVariableDeclarationgetInstance()Returns the corresponding IVML model instance.java.lang.StringgetName()Returns the name of the variable.java.lang.StringgetType()Returns the type of the variable.java.lang.StringgetValue()Returns the configured value for this variable.booleanhasFrozenValue()Returns whether the this variable has been configured and is frozen.booleanhasValue()Returns whether there this variable has been configured with a value.voidsetBindingTime(Enum bindingTimes, EnumLiteral bindingTime)Changes the binding time.
-
-
-
Field Detail
-
ATTRIBUTE_NAME_BINDING_TIME
private static final java.lang.String ATTRIBUTE_NAME_BINDING_TIME
- See Also:
- Constant Field Values
-
variable
private DecisionVariableDeclaration variable
-
value
private IDecisionVariable value
-
bindingTime
private EnumLiteral bindingTime
-
-
Constructor Detail
-
DecisionVariable
DecisionVariable(DecisionVariableDeclaration variable, IDecisionVariable value)
Creates a decision variable.- Parameters:
variable- the IVML variablevalue- the related decision variable
-
DecisionVariable
public DecisionVariable(java.lang.String name, IDatatype type, java.lang.String defaultValue, Project parent) throws ModelExceptionCreates a new decision variable.- Parameters:
name- the name of the variabletype- the type of the variabledefaultValue- the default value (may be null)parent- the parent of the variable, i.e. the project- Throws:
ModelException- in case that the given value does not match totype
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:IDecisionVariableReturns the name of the variable.- Specified by:
getNamein interfaceIDecisionVariable- Returns:
- the name of the variable
-
getType
public java.lang.String getType()
Description copied from interface:IDecisionVariableReturns the type of the variable.- Specified by:
getTypein interfaceIDecisionVariable- Returns:
- the type of the variable, possibly adjusted by the model after adding this variable if the model supports fault-tolerance
-
getBindingTime
public java.lang.String getBindingTime()
Description copied from interface:IDecisionVariableReturns the binding time of the variable.- Specified by:
getBindingTimein interfaceIDecisionVariable- Returns:
- the binding time, may be null if none is defined
-
getDefaultValue
public java.lang.String getDefaultValue()
Description copied from interface:IDecisionVariableReturns the default value of the variable as specified as part of the variable declaration in the underlying IVML model. For obtaining the actual value in a configuration, please refer toIDecisionVariable.getValue().- Specified by:
getDefaultValuein interfaceIDecisionVariable- Returns:
- the default value, may be null if none is defined, possibly adjusted by the model after adding this variable if the model supports fault-tolerance
-
getValue
public java.lang.String getValue()
Description copied from interface:IDecisionVariableReturns the configured value for this variable. Please considerIDecisionVariable.hasValue()andIDecisionVariable.hasFrozenValue()in order to judge the return value correctly.- Specified by:
getValuein interfaceIDecisionVariable- Returns:
- the configured value for this variable, may be null if the actual
value is null or if the variable has not been configured (see
IDecisionVariable.hasValue())
-
hasValue
public boolean hasValue()
Description copied from interface:IDecisionVariableReturns whether there this variable has been configured with a value.- Specified by:
hasValuein interfaceIDecisionVariable- Returns:
trueif variable has been configured,falseelse
-
hasFrozenValue
public boolean hasFrozenValue()
Description copied from interface:IDecisionVariableReturns whether the this variable has been configured and is frozen.- Specified by:
hasFrozenValuein interfaceIDecisionVariable- Returns:
trueif the configured value is frozen,falseelse
-
setBindingTime
public void setBindingTime(Enum bindingTimes, EnumLiteral bindingTime) throws ModelException
Changes the binding time.- Parameters:
bindingTimes- the binding times enumbindingTime- the new binding time- Throws:
ModelException- in case that the value cannot be set
-
getBindingTimeAttribute
Attribute getBindingTimeAttribute()
Returns the binding time attribute if there is any.- Returns:
- the binding times attribute
-
getInstance
public DecisionVariableDeclaration getInstance()
Returns the corresponding IVML model instance.- Returns:
- the corresponding model instance
-
-