Class VariableCreator
- java.lang.Object
-
- net.ssehub.easy.varModel.confModel.VariableCreator
-
- All Implemented Interfaces:
IDatatypeVisitor
public class VariableCreator extends java.lang.Object implements IDatatypeVisitor
Factory for convertingAbstractVariableintoDecisionVariable. Creates theDecisionVariableand sets the default value if possible.- Author:
- El-Sharkawy, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private ConfigurationExceptionconfigExcetionprivate booleanisAttributeprivate booleanisVisibleprivate IConfigurationElementparentprivate AbstractVariablevarDeclprivate IDecisionVariablevariable
-
Constructor Summary
Constructors Constructor Description VariableCreator(AbstractVariable varDecl, IConfigurationElement parent, boolean isVisible, boolean isAttribute)Sole constructor for this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDecisionVariablegetVariable()Returns the created variable.(package private) IDecisionVariablegetVariable(boolean setDefaultValue)Return theIDecisionVariableas ingetVariable().voidvisitAnyType(AnyType datatype)Is called by an AnyType.voidvisitBooleanType(BooleanType type)Visiting method for visiting aBooleanType.voidvisitCompoundType(Compound compound)Visiting method for visiting aCompound.voidvisitConstraintType(ConstraintType type)Visiting method for visiting aConstraintType.voidvisitDatatype(IDatatype datatype)Is called by an arbitrary data type.voidvisitDerivedType(DerivedDatatype datatype)Is called by anDerivedDatatypedata type.voidvisitEnumType(Enum enumType)Visiting method for visiting aEnum.voidvisitIntegerType(IntegerType type)Visiting method for visiting aIntegerType.voidvisitMetaType(MetaType datatype)Is called by a MetaType.voidvisitOrderedEnumType(OrderedEnum enumType)Visiting method for visiting aOrderredEnum.voidvisitRealType(RealType type)Visiting method for visiting aRealType.voidvisitReference(Reference reference)Is called by a reference data type.voidvisitSequence(Sequence sequence)Is called by a sequence datatype.voidvisitSet(Set set)Is called by a set data type.voidvisitStringType(StringType type)Visiting method for visiting aStringType.voidvisitVersionType(VersionType type)Visiting method for visiting aVersionType.
-
-
-
Field Detail
-
variable
private IDecisionVariable variable
-
parent
private IConfigurationElement parent
-
varDecl
private AbstractVariable varDecl
-
configExcetion
private ConfigurationException configExcetion
-
isVisible
private boolean isVisible
-
isAttribute
private boolean isAttribute
-
-
Constructor Detail
-
VariableCreator
public VariableCreator(AbstractVariable varDecl, IConfigurationElement parent, boolean isVisible, boolean isAttribute)
Sole constructor for this class.- Parameters:
varDecl- The specification of the variable which should be createdparent- The parent this variable is part of, typically theConfigurationinstance, but in case of compounds also the containingDecisionVariableisVisible- Specifies whether this variables is exported by an interface or not:- true: The variable is exported by an interface or there is no interface .
- false: There is an interface which does not export this variable .
isAttribute- whether a variable represents (as part of) an attribute or an usual variable shall be created
-
-
Method Detail
-
getVariable
public IDecisionVariable getVariable() throws ConfigurationException
Returns the created variable.- Returns:
- The
DecisionVariablerepresenting the givenAbstractVariable. - Throws:
ConfigurationException- in case that the types ofAbstractVariableandDecisionVariabledo not comply
-
getVariable
IDecisionVariable getVariable(boolean setDefaultValue) throws ConfigurationException
Return theIDecisionVariableas ingetVariable(). However, during the initialization ofNestedVarConfigProviderthe usage of theDefaultValueSetterwill causeNullPointerException's. Therefore, this method with setDefaultValue = false should be used inside the initialization of nestedIDecisionVariables.- Parameters:
setDefaultValue- true if the default value should be set for the newly createdIDecisionVariable, otherwise false.- Returns:
- The
IDecisionVariablerepresenting the givenAbstractVariable, which was created by running the constructor of this class. - Throws:
ConfigurationException- in case that the types ofAbstractVariableandDecisionVariabledo not comply
-
visitDatatype
public void visitDatatype(IDatatype datatype)
Description copied from interface:IDatatypeVisitorIs called by an arbitrary data type.- Specified by:
visitDatatypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitAnyType
public void visitAnyType(AnyType datatype)
Description copied from interface:IDatatypeVisitorIs called by an AnyType.- Specified by:
visitAnyTypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitMetaType
public void visitMetaType(MetaType datatype)
Description copied from interface:IDatatypeVisitorIs called by a MetaType.- Specified by:
visitMetaTypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitDerivedType
public void visitDerivedType(DerivedDatatype datatype)
Description copied from interface:IDatatypeVisitorIs called by anDerivedDatatypedata type.- Specified by:
visitDerivedTypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitSet
public void visitSet(Set set)
Description copied from interface:IDatatypeVisitorIs called by a set data type.- Specified by:
visitSetin interfaceIDatatypeVisitor- Parameters:
set- the set instance
-
visitSequence
public void visitSequence(Sequence sequence)
Description copied from interface:IDatatypeVisitorIs called by a sequence datatype.- Specified by:
visitSequencein interfaceIDatatypeVisitor- Parameters:
sequence- the sequence instance
-
visitReference
public void visitReference(Reference reference)
Description copied from interface:IDatatypeVisitorIs called by a reference data type.- Specified by:
visitReferencein interfaceIDatatypeVisitor- Parameters:
reference- the references instance
-
visitBooleanType
public void visitBooleanType(BooleanType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aBooleanType.- Specified by:
visitBooleanTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitStringType
public void visitStringType(StringType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aStringType.- Specified by:
visitStringTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitConstraintType
public void visitConstraintType(ConstraintType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aConstraintType.- Specified by:
visitConstraintTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitIntegerType
public void visitIntegerType(IntegerType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aIntegerType.- Specified by:
visitIntegerTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitRealType
public void visitRealType(RealType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aRealType.- Specified by:
visitRealTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitCompoundType
public void visitCompoundType(Compound compound)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aCompound.- Specified by:
visitCompoundTypein interfaceIDatatypeVisitor- Parameters:
compound- TheCompoundwhich should be visited.
-
visitEnumType
public void visitEnumType(Enum enumType)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aEnum.- Specified by:
visitEnumTypein interfaceIDatatypeVisitor- Parameters:
enumType- TheEnumwhich should be visited.
-
visitOrderedEnumType
public void visitOrderedEnumType(OrderedEnum enumType)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aOrderredEnum.- Specified by:
visitOrderedEnumTypein interfaceIDatatypeVisitor- Parameters:
enumType- TheEnumwhich should be visited.
-
visitVersionType
public void visitVersionType(VersionType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aVersionType.- Specified by:
visitVersionTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
-