Package net.ssehub.easy.varModel.model
Class PartialEvaluationBlock
- java.lang.Object
-
- net.ssehub.easy.varModel.model.ModelElement
-
- net.ssehub.easy.varModel.model.ContainableModelElement
-
- net.ssehub.easy.varModel.model.EvaluationBlock
-
- net.ssehub.easy.varModel.model.PartialEvaluationBlock
-
- All Implemented Interfaces:
IDatatypeVisitable,IModelElement
public class PartialEvaluationBlock extends EvaluationBlock
Maintains partial evaluable elements.- Author:
- Marcel Lueder, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private IPartialEvaluable[]elementsprivate java.util.List<ContainableModelElement>modelElementsprivate PartialEvaluationBlock[]nested
-
Constructor Summary
Constructors Constructor Description PartialEvaluationBlock(java.lang.String name, IModelElement parent)Constructor for the partial evaluation block.PartialEvaluationBlock(java.lang.String name, IPartialEvaluable[] elements, IModelElement parent)Constructor for the partial evaluation block.PartialEvaluationBlock(java.lang.String name, IPartialEvaluable[] elements, PartialEvaluationBlock[] nested, IModelElement parent)Constructor for the partial evaluation block.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IModelVisitor visitor)Accept method for the visitor.voidaddModelElement(ContainableModelElement element)Adds a model element in sequence.IPartialEvaluablegetEvaluable(int index)Returns the constraint specified byindex.intgetEvaluableCount()Returns the number of constraints.ContainableModelElementgetModelElement(int index)Returns the specified model element.intgetModelElementCount()Returns the number of model elements.PartialEvaluationBlockgetNested(int index)Returns the nested block specified byindex.intgetNestedCount()Returns the number of nested blocks.booleanisEmpty()Checks whether the evaluation block is empty.voidsetEvaluables(IPartialEvaluable[] elements)Changes the evaluables.voidsetNested(PartialEvaluationBlock[] nested)Changes the nested blocks.-
Methods inherited from class net.ssehub.easy.varModel.model.ContainableModelElement
accept, getNameSpace, getParent, getProject, getQualifiedName, getTopLevelParent, isTopLevel, setParent
-
Methods inherited from class net.ssehub.easy.varModel.model.ModelElement
findAttribute, getComment, getName, getUniqueName, isTransparent, propagateAttribute, setComment, setName, toString
-
-
-
-
Field Detail
-
elements
private IPartialEvaluable[] elements
-
nested
private PartialEvaluationBlock[] nested
-
modelElements
private java.util.List<ContainableModelElement> modelElements
-
-
Constructor Detail
-
PartialEvaluationBlock
public PartialEvaluationBlock(java.lang.String name, IModelElement parent)Constructor for the partial evaluation block.- Parameters:
name- Name of the partial evaluation blockparent- the object, in which this specific one is embedded
-
PartialEvaluationBlock
public PartialEvaluationBlock(java.lang.String name, IPartialEvaluable[] elements, IModelElement parent)Constructor for the partial evaluation block.- Parameters:
name- Name of the partial evaluation blockelements- the evaluable elementsparent- the object, in which this specific one is embedded
-
PartialEvaluationBlock
public PartialEvaluationBlock(java.lang.String name, IPartialEvaluable[] elements, PartialEvaluationBlock[] nested, IModelElement parent)Constructor for the partial evaluation block.- Parameters:
name- Name of the partial evaluation blockelements- the evaluable elementsnested- nested evaluation blocks (may be null)parent- the object, in which this specific one is embedded
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Checks whether the evaluation block is empty.- Overrides:
isEmptyin classEvaluationBlock- Returns:
- true if empty
-
getEvaluable
public IPartialEvaluable getEvaluable(int index)
Returns the constraint specified byindex.- Parameters:
index- a 0-based index specifying the evaluable to be returned- Returns:
- the specified evaluable
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getEvaluableCount()
-
getEvaluableCount
public int getEvaluableCount()
Returns the number of constraints.- Returns:
- the number of constraints
-
setEvaluables
public void setEvaluables(IPartialEvaluable[] elements)
Changes the evaluables. [required as consequence of parent elements]- Parameters:
elements- the new evaluables (may be null)
-
getNested
public PartialEvaluationBlock getNested(int index)
Returns the nested block specified byindex.- Parameters:
index- a 0-based index specifying the block to be returned- Returns:
- the specified nested block
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getNestedCount()
-
getNestedCount
public int getNestedCount()
Returns the number of nested blocks.- Returns:
- the number of nested blocks
-
setNested
public void setNested(PartialEvaluationBlock[] nested)
Changes the nested blocks. [required as consequence of parent elements]- Parameters:
nested- the new nested blocks (may be null)
-
accept
public void accept(IModelVisitor visitor)
Description copied from interface:IModelElementAccept method for the visitor.- Parameters:
visitor- The visitor, which should process this model element.
-
getModelElement
public ContainableModelElement getModelElement(int index)
Returns the specified model element.- Parameters:
index- the 0-based index of the model element- Returns:
- the model-element
- Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index >=getModelElementCount()
-
getModelElementCount
public int getModelElementCount()
Returns the number of model elements.- Returns:
- the number of model elements
-
addModelElement
public void addModelElement(ContainableModelElement element)
Adds a model element in sequence. 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.- Parameters:
element- the model element
-
-