Package net.ssehub.easy.varModel.model
Interface IDecisionVariableContainer
- All Superinterfaces:
IContainableElementsSorter,IModelElement
- All Known Implementing Classes:
AttributeAssignment,BasicDecisionVariableContainer,Compound,FullDecisionVariableContainer
Describes a container for decision variables.
- Author:
- Holger Eichelberger
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AttributeAssignment assignment) Adds a nested assignment.voidAdds a comment to the list of contained elements.booleanMethod to add an object to the elements list of the project.voidadd(EvaluationBlock eval) adds a nested evaluation block.voidaddConstraint(Constraint constraint, boolean internal) Adds a constraint.booleanReturns whether this element containsvar.booleancontainsByName(String name) Returns whether this project contains an element and its name.voidForces theIDecisionVariableContainerto update cached lists of nestedDecisionVariableDeclarations.getAssignment(int index) Returns the assignment specified byindex.intReturns the number of assignments.getConstraint(int index) Returns the specified contained constraint.intReturns the number of contained constraints.getDeclaration(int index) Returns the specifiedDecisionVariableDeclaration.intReturns the number of all nestedDecisionVariableDeclarations including nestedDecisionVariableDeclarations ofAttributeAssignments.getElement(int index) Returns the element specified byindex.getElement(String name) Returns the element specified byname.intReturns the number of elements.getModelElement(int index) Returns a contained model element specified byindex.intReturns the number of contained elements.getRealizing(int index) Returns the specified realizing constraint.intReturns the number of realizing constraints.Methods inherited from interface net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter
sortContainedElementsMethods inherited from interface net.ssehub.easy.varModel.model.IModelElement
accept, getComment, getName, getNameSpace, getParent, getQualifiedName, getUniqueName, isTransparent, propagateAttribute, setComment
-
Method Details
-
add
Adds a nested assignment.- Parameters:
assignment- the assignment which should be added
-
add
adds a nested evaluation block.- Parameters:
eval- the eval block
-
getAssignmentCount
int getAssignmentCount()Returns the number of assignments.- Returns:
- the number of assignments
-
getAssignment
Returns the assignment specified byindex.- Parameters:
index- a 0-based index specifying the element to be returned- Returns:
- the assignment
- Throws:
IndexOutOfBoundsException- ifindex<0 || index>=getAssignmentCount()
-
getModelElement
Returns a contained model element specified byindex. Please note that this method returns all contained model elements, i.e., decision variables and constraints and is intended to restore the input sequence correctly.- Parameters:
index- a 0-based index specifying the operation to be returned- Returns:
- the contained element
- Throws:
IndexOutOfBoundsException- ifindex<0 || index>=getModelElementCount()
-
getModelElementCount
int getModelElementCount()Returns the number of contained elements. Please note that this method refers to all contained model elements, i.e., decision variables and constraints and is intended to restore the input sequence correctly.- Returns:
- the number of contained elements
-
getElement
Returns the element specified byname.- Parameters:
name- the name of the element- Returns:
- the element, null if none was found
-
contains
Returns whether this element containsvar.- Parameters:
var- the variable declaration to search for- Returns:
trueif found,falseelse
-
add
Adds a comment to the list of contained elements.- Parameters:
comment- the comment to be added
-
getElementCount
int getElementCount()Returns the number of elements.- Returns:
- the number of elements
-
getElement
Returns the element specified byindex.- Parameters:
index- a 0-based index specifying the element to be returned- Returns:
- the element
- Throws:
IndexOutOfBoundsException- ifindex<0 || index>=getElementCount()
-
add
Method to add an object to the elements list of the project.- Parameters:
elem- which should be added- Returns:
trueif the addition was successful,falseelse due to duplicated variable declaration
-
getConstraintsCount
int getConstraintsCount()Returns the number of contained constraints.- Returns:
- the number of constraints
-
getConstraint
Returns the specified contained constraint.- Parameters:
index- the index of the constraint to be returned- Returns:
- the specified constraint
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getConstraintsCount()
-
addConstraint
Adds a constraint.- Parameters:
constraint- the constraint to be addedinternal- whether the constraint is internally created while building up the model (ignored)
-
getRealizingCount
int getRealizingCount()Returns the number of realizing constraints. Please note that these constraints are derived and not originally specified in the input IVML model.- Returns:
- the number of constraints
-
getRealizing
Returns the specified realizing constraint. Please note that these constraints are derived and not originally specified in the input IVML model.- Parameters:
index- the index of the constraint to be returned- Returns:
- the specified constraint
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getRealizingCount()
-
getDeclarationCount
int getDeclarationCount()Returns the number of all nestedDecisionVariableDeclarations including nestedDecisionVariableDeclarations ofAttributeAssignments.- Returns:
- The number of all nested
DecisionVariableDeclarations. This will be greater or equal to 0.
-
getDeclaration
Returns the specifiedDecisionVariableDeclaration.- Parameters:
index- the index of theDecisionVariableDeclarationto be returned- Returns:
- the specified
DecisionVariableDeclaration - Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getDeclarationCount()
-
containsByName
Returns whether this project contains an element and its name.- Parameters:
name- the name to search for- Returns:
trueif this project contains the specified element,falseelse
-
forceUpdate
void forceUpdate()Forces theIDecisionVariableContainerto update cached lists of nestedDecisionVariableDeclarations. This is only necessary if multipleIDecisionVariableContainerare nested into each other and only during incremental build up if an inner element is updated while already added to the outer element.
-