Class Model
- java.lang.Object
-
- net.ssehub.easy.integration.common.impl.Model
-
-
Field Summary
Fields Modifier and Type Field Description private Configurationconfigurationprivate Projectprojectprivate java.util.List<IDatatype>typesprivate java.util.List<DecisionVariable>variables
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadd(DecisionVariable variable)Adds a decision variable to this model and updates the cached information.protected voidadd(CustomDatatype type)Adds a decision custom type to this model and updates the cached information.private voidcollect(ContainableModelElement elt)Collects cached information forelt.IConstraintcreateConstraint(java.lang.String constraint)Creates a constraint from the given string.private voidcreateModelContent(Project project)Creates the model content based on the givenproject.java.lang.StringgetName()Returns the name of the model.protected ProjectgetProject()Returns the project instance.java.lang.StringgetType(int index)Returns a particular known type.intgetTypesCount()Returns the number of types known to this model.IDecisionVariablegetVariable(int index)Returns a particular decision variable.IDecisionVariablegetVariable(java.lang.String name)Returns a decision variable by it's (valid IVML) name.intgetVariablesCount()Returns the number of decision variables stored in this model.java.lang.StringgetVersion()Returns the name of the version.private voidresolveImports(ProjectImport pImport)Resolves project import in terms of collecting type and variable definitions.java.lang.StringtoString()Returns the textual representation of this model.
-
-
-
Field Detail
-
project
private Project project
-
configuration
private Configuration configuration
-
variables
private java.util.List<DecisionVariable> variables
-
types
private java.util.List<IDatatype> types
-
-
Constructor Detail
-
Model
protected Model(Project project)
Creates a model backed byproject.- Parameters:
project- the IVML project instance
-
-
Method Detail
-
createModelContent
private void createModelContent(Project project)
Creates the model content based on the givenproject.- Parameters:
project- the IVML project instance
-
collect
private void collect(ContainableModelElement elt)
Collects cached information forelt.- Parameters:
elt- the element to cache information for
-
resolveImports
private void resolveImports(ProjectImport pImport)
Resolves project import in terms of collecting type and variable definitions.- Parameters:
pImport- the project import from which additional cache information will be stored
-
getName
public java.lang.String getName()
Description copied from interface:IModelReturns the name of the model.
-
getVersion
public java.lang.String getVersion()
Description copied from interface:IModelReturns the name of the version.- Specified by:
getVersionin interfaceIModel- Returns:
- the name of the version (may be null)
-
getVariablesCount
public int getVariablesCount()
Description copied from interface:IModelReturns the number of decision variables stored in this model.- Specified by:
getVariablesCountin interfaceIModel- Returns:
- the number of decision variables
-
getVariable
public IDecisionVariable getVariable(int index)
Description copied from interface:IModelReturns a particular decision variable.- Specified by:
getVariablein interfaceIModel- Parameters:
index- the 0-based index of the variable to be returned- Returns:
- the specified variable
-
getVariable
public IDecisionVariable getVariable(java.lang.String name) throws ModelException
Returns a decision variable by it's (valid IVML) name.- Specified by:
getVariablein interfaceIModel- Parameters:
name- the name of the variable- Returns:
- the decision variable (or null if not found)
- Throws:
ModelException- in case of any semantic problem
-
getTypesCount
public int getTypesCount()
Description copied from interface:IModelReturns the number of types known to this model.- Specified by:
getTypesCountin interfaceIModel- Returns:
- the number of types
-
getType
public java.lang.String getType(int index)
Description copied from interface:IModelReturns a particular known type.
-
add
protected void add(CustomDatatype type) throws ModelException
Adds a decision custom type to this model and updates the cached information.- Parameters:
type- the type to add- Throws:
ModelException- in case that the same variable is about to be defined multiple times
-
add
protected void add(DecisionVariable variable) throws ModelException
Adds a decision variable to this model and updates the cached information.- Parameters:
variable- the variable to add- Throws:
ModelException- in case that the same variable is about to be defined multiple times
-
getProject
protected Project getProject()
Returns the project instance.- Returns:
- the project instance
-
toString
public java.lang.String toString()
Returns the textual representation of this model.
-
createConstraint
public IConstraint createConstraint(java.lang.String constraint) throws ModelException
Description copied from interface:IModelCreates a constraint from the given string. This method does not modify the model.- Specified by:
createConstraintin interfaceIModel- Parameters:
constraint- the string to be turned into a constraint (in IVML notation)- Returns:
- the constraint
- Throws:
ModelException- in case of syntactical or semantical problems
-
-