Class CompoundInstance
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.CompoundInstance
-
- All Implemented Interfaces:
IInitializableValue,IStringValueProvider
public class CompoundInstance extends java.lang.Object implements IInitializableValue, IStringValueProvider
Represents a compound instance.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Object>slotValuesprivate CompoundTypeDescriptortype
-
Constructor Summary
Constructors Constructor Description CompoundInstance(CompoundTypeDescriptor type)Creates a compound instance and leaves it uninitialized.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private FieldDescriptorcheckSlot(java.lang.String name)Checks whether there is a slot with givenname.java.lang.ObjectgetSlotValue(java.lang.String name)Returns the value of the slotname.java.lang.StringgetStringValue(IStringValueProvider.StringComparator comparator)Returns the string value of this object.CompoundTypeDescriptorgetType()Returns the type of this compound instance.voidinitialize(IExpressionVisitor evaluator)Initializes this value instance through the given evaluator.private voidinitializeFor(IExpressionVisitor evaluator, CompoundTypeDescriptor type)Initializes this instance for the given (parent)type.voidsetSlotValue(java.lang.String name, java.lang.Object value)Changes the value of slotname.
-
-
-
Field Detail
-
type
private CompoundTypeDescriptor type
-
slotValues
private java.util.Map<java.lang.String,java.lang.Object> slotValues
-
-
Constructor Detail
-
CompoundInstance
public CompoundInstance(CompoundTypeDescriptor type)
Creates a compound instance and leaves it uninitialized.- Parameters:
type- the type- See Also:
#initialize(EvaluationVisitor)
-
-
Method Detail
-
initialize
public void initialize(IExpressionVisitor evaluator) throws VilException
Description copied from interface:IInitializableValueInitializes this value instance through the given evaluator.- Specified by:
initializein interfaceIInitializableValue- Parameters:
evaluator- the evaluator- Throws:
VilException- in case of evaluation problems
-
initializeFor
private void initializeFor(IExpressionVisitor evaluator, CompoundTypeDescriptor type) throws VilException
Initializes this instance for the given (parent)type.- Parameters:
evaluator- the evaluatortype- the type to initialize for- Throws:
VilException- in case that evaluating initialization expressions fails
-
getType
public CompoundTypeDescriptor getType()
Returns the type of this compound instance.- Returns:
- the type
-
getSlotValue
public java.lang.Object getSlotValue(java.lang.String name) throws VilExceptionReturns the value of the slotname.- Parameters:
name- the name of the slot- Returns:
- the slot value (may be null for undefined)
- Throws:
VilException- if there is no such slot defined
-
checkSlot
private FieldDescriptor checkSlot(java.lang.String name) throws VilException
Checks whether there is a slot with givenname.- Parameters:
name- the name of the slot- Returns:
- the slot
- Throws:
VilException- if there is no such slot
-
setSlotValue
public void setSlotValue(java.lang.String name, java.lang.Object value) throws VilExceptionChanges the value of slotname.- Parameters:
name- the name of the slotvalue- the value- Throws:
VilException- if there is no such slot defined
-
getStringValue
public java.lang.String getStringValue(IStringValueProvider.StringComparator comparator)
Description copied from interface:IStringValueProviderReturns the string value of this object.- Specified by:
getStringValuein interfaceIStringValueProvider- Parameters:
comparator- if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned- Returns:
- the string value
-
-