Package net.ssehub.easy.varModel.model
Interface IDecisionVariableContainer
-
- All Superinterfaces:
IContainableElementsSorter,IModelElement
- All Known Implementing Classes:
AttributeAssignment,BasicDecisionVariableContainer,Compound,FullDecisionVariableContainer
public interface IDecisionVariableContainer extends IModelElement, IContainableElementsSorter
Describes a container for decision variables.- Author:
- Holger Eichelberger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(AttributeAssignment assignment)Adds a nested assignment.voidadd(Comment comment)Adds a comment to the list of contained elements.booleanadd(DecisionVariableDeclaration elem)Method 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.booleancontains(DecisionVariableDeclaration var)Returns whether this element containsvar.booleancontainsByName(java.lang.String name)Returns whether this project contains an element and its name.voidforceUpdate()Forces theIDecisionVariableContainerto update cached lists of nestedDecisionVariableDeclarations.AttributeAssignmentgetAssignment(int index)Returns the assignment specified byindex.intgetAssignmentCount()Returns the number of assignments.ConstraintgetConstraint(int index)Returns the specified contained constraint.intgetConstraintsCount()Returns the number of contained constraints.DecisionVariableDeclarationgetDeclaration(int index)Returns the specifiedDecisionVariableDeclaration.intgetDeclarationCount()Returns the number of all nestedDecisionVariableDeclarations including nestedDecisionVariableDeclarations ofAttributeAssignments.DecisionVariableDeclarationgetElement(int index)Returns the element specified byindex.DecisionVariableDeclarationgetElement(java.lang.String name)Returns the element specified byname.intgetElementCount()Returns the number of elements.ContainableModelElementgetModelElement(int index)Returns a contained model element specified byindex.intgetModelElementCount()Returns the number of contained elements.ConstraintgetRealizing(int index)Returns the specified realizing constraint.intgetRealizingCount()Returns the number of realizing constraints.-
Methods inherited from interface net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter
sortContainedElements
-
Methods inherited from interface net.ssehub.easy.varModel.model.IModelElement
accept, getComment, getName, getNameSpace, getParent, getQualifiedName, getUniqueName, isTransparent, propagateAttribute, setComment
-
-
-
-
Method Detail
-
add
void add(AttributeAssignment assignment)
Adds a nested assignment.- Parameters:
assignment- the assignment which should be added
-
add
void add(EvaluationBlock eval)
adds a nested evaluation block.- Parameters:
eval- the eval block
-
getAssignmentCount
int getAssignmentCount()
Returns the number of assignments.- Returns:
- the number of assignments
-
getAssignment
AttributeAssignment getAssignment(int index)
Returns the assignment specified byindex.- Parameters:
index- a 0-based index specifying the element to be returned- Returns:
- the assignment
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getAssignmentCount()
-
getModelElement
ContainableModelElement getModelElement(int index)
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:
java.lang.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
DecisionVariableDeclaration getElement(java.lang.String name)
Returns the element specified byname.- Parameters:
name- the name of the element- Returns:
- the element, null if none was found
-
contains
boolean contains(DecisionVariableDeclaration var)
Returns whether this element containsvar.- Parameters:
var- the variable declaration to search for- Returns:
trueif found,falseelse
-
add
void add(Comment comment)
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
DecisionVariableDeclaration getElement(int index)
Returns the element specified byindex.- Parameters:
index- a 0-based index specifying the element to be returned- Returns:
- the element
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getElementCount()
-
add
boolean add(DecisionVariableDeclaration elem)
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
Constraint getConstraint(int index)
Returns the specified contained constraint.- Parameters:
index- the index of the constraint to be returned- Returns:
- the specified constraint
- Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index >=getConstraintsCount()
-
addConstraint
void addConstraint(Constraint constraint, boolean internal)
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
Constraint getRealizing(int index)
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:
java.lang.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
DecisionVariableDeclaration getDeclaration(int index)
Returns the specifiedDecisionVariableDeclaration.- Parameters:
index- the index of theDecisionVariableDeclarationto be returned- Returns:
- the specified
DecisionVariableDeclaration - Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index >=getDeclarationCount()
-
containsByName
boolean containsByName(java.lang.String name)
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.
-
-