Class AbstractIvmlTypeDescriptor
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<DecisionVariable>
-
- net.ssehub.easy.instantiation.core.model.vilTypes.configuration.AbstractIvmlTypeDescriptor
-
- All Implemented Interfaces:
IMetaType
- Direct Known Subclasses:
IvmlProjectTypeDescriptor,IvmlTypeDescriptor
abstract class AbstractIvmlTypeDescriptor extends TypeDescriptor<DecisionVariable>
Implements a dynamic type descriptor for IVM decision variables. Instances of this class represent IVML types and act as a frontend forDecisionVariable, thus,decision variablesare assignable.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private AbstractIvmlTypeDescriptorrefinesprivate TypeRegistrytypeRegistry-
Fields inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor
EMPTY
-
-
Constructor Summary
Constructors Constructor Description AbstractIvmlTypeDescriptor()For serialization.AbstractIvmlTypeDescriptor(IDatatype ivmlType, IvmlTypeResolver resolver)Creates a new type descriptor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddAttributeFields(java.util.Map<java.lang.String,FieldDescriptor> fields, IModelElement elt, TypeRegistry registry)Adds the attribute access fields.protected voidaddComparisonOperations(IDatatype type, java.util.Map<java.lang.String,OperationDescriptor> operations)Adds the default comparison operations.protected voidaddConversionOperations(IDatatype type, java.util.List<OperationDescriptor> operations)Adds required conversion operations tooperations.protected voidaddDecisionVariableOperations(java.util.Map<java.lang.String,OperationDescriptor> operations)Adds the operations to be taken over fromDecisionVariable.booleancanBeInstantiated()Returns whetherTypeDescriptor.create(Object...)will return an instance.DecisionVariablecreate(java.lang.Object... params)Creates an instance of the type according to the given parameters.java.lang.ObjectgetDefaultValue()Returns the default value for this type, usually a neutral value or a constant value to compare against.protected abstract IDatatypegetIvmlType()Returns the underlying IVML type.(package private) AbstractIvmlTypeDescriptorgetRefines()Returns the type descriptor which is refined by this descriptor.IMetaTypegetSuperType()Returns the type this type is refined from.java.lang.Class<DecisionVariable>getTypeClass()Returns the class of the described VIL type.TypeRegistrygetTypeRegistry()Returns the type registry this type was registered by.private static booleanincludeMethod(java.lang.reflect.Method method)Determines whether amethodshall be included as automatically mapped operation.booleanisActualTypeOf(IMetaType type)Returns whether this type can act as an actual type oftype.booleanisAssignableFrom(IMetaType type)Returns whether this type is the same or a super class oftype.booleanisBasicType()Returns whether this instance represents a basic type.booleanisCollection()Returns whether this descriptor represents a VIL collection, i.e., set, sequence or collection.protected booleanisEqual(AbstractIvmlTypeDescriptor d1, AbstractIvmlTypeDescriptor d2)Returns whether two IVML type descriptors are considered to be equal.booleanisIterator()Returns whether this descriptor represents an iterator.booleanisMap()Returns whether this descriptor represents a VIL map.booleanisSequence()Returns whether this descriptor represents a VIL sequence.booleanisSet()Returns whether this descriptor represents a VIL set.protected voidsetRefines(AbstractIvmlTypeDescriptor refines)Changes the type descriptor which is refined by this descriptor.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor
addOperation, addPlaceholderOperation, allInstances, appendParameter, createArray, enableDynamicDispatch, findCollectionIteratorOperation, findConversion, findConversion, findConversionOnBoth, flatten, flattenParam, getCandidates, getCandidates, getConversion, getConversions, getConversionsCount, getConversionToSequence, getField, getField, getFieldCount, getFields, getGenericParameter, getGenericParameterCount, getGenericParameterType, getName, getOperation, getOperations, getOperationsCount, getQualifiedName, getVilName, isAssignableFrom, isFieldsNull, isInitialized, isInstance, isInstantiator, isNameSet, isSame, isSameType, setConversions, setFields, setFields, setName, setOperations, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IMetaType
checkConversion, getBaseType, isInternal, isPlaceholder
-
-
-
-
Field Detail
-
typeRegistry
private TypeRegistry typeRegistry
-
refines
private AbstractIvmlTypeDescriptor refines
-
-
Constructor Detail
-
AbstractIvmlTypeDescriptor
AbstractIvmlTypeDescriptor() throws VilExceptionFor serialization.- Throws:
VilException- shall not occur
-
AbstractIvmlTypeDescriptor
AbstractIvmlTypeDescriptor(IDatatype ivmlType, IvmlTypeResolver resolver) throws VilException
Creates a new type descriptor. Overridden constructors shall callTypeDescriptor.setOperations(java.util.Collection)andTypeDescriptor.setConversions(java.util.Collection).- Parameters:
ivmlType- the IVML type to create the descriptor forresolver- for retrieving further IVML types- Throws:
VilException- if analyzing the class fails for some reason
-
-
Method Detail
-
addDecisionVariableOperations
protected void addDecisionVariableOperations(java.util.Map<java.lang.String,OperationDescriptor> operations)
Adds the operations to be taken over fromDecisionVariable. CallsincludeMethod(Method).- Parameters:
operations- the operations (signature-descriptor) (to be modified as a side effect)
-
includeMethod
private static boolean includeMethod(java.lang.reflect.Method method)
Determines whether amethodshall be included as automatically mapped operation.- Parameters:
method- the method to be considered- Returns:
trueifmethodshall be included,falseelse
-
addComparisonOperations
protected void addComparisonOperations(IDatatype type, java.util.Map<java.lang.String,OperationDescriptor> operations)
Adds the default comparison operations.- Parameters:
type- the IVML type to add the operations foroperations- the operations (signature-descriptor) (to be modified as a side effect)
-
addConversionOperations
protected void addConversionOperations(IDatatype type, java.util.List<OperationDescriptor> operations)
Adds required conversion operations tooperations.- Parameters:
type- the IVML type to add the operations foroperations- the operations to be modified as a side effect
-
addAttributeFields
protected void addAttributeFields(java.util.Map<java.lang.String,FieldDescriptor> fields, IModelElement elt, TypeRegistry registry) throws VilException
Adds the attribute access fields.- Parameters:
fields- the fields (signature-field) (to be modified as a side effect)elt- the model element to take the attributes fromregistry- the actual type registry- Throws:
VilException- in case that creating the descriptors fails
-
isBasicType
public boolean isBasicType()
Description copied from interface:IMetaTypeReturns whether this instance represents a basic type.- Returns:
trueif this instance represents a basic type,falseelse
-
getTypeRegistry
public TypeRegistry getTypeRegistry()
Description copied from interface:IMetaTypeReturns the type registry this type was registered by.- Returns:
- the type registry
-
getTypeClass
public java.lang.Class<DecisionVariable> getTypeClass()
Description copied from class:TypeDescriptorReturns the class of the described VIL type. Please use this method sparingly as the required functionality is provided by this class.- Specified by:
getTypeClassin classTypeDescriptor<DecisionVariable>- Returns:
- the class
-
canBeInstantiated
public boolean canBeInstantiated()
Description copied from class:TypeDescriptorReturns whetherTypeDescriptor.create(Object...)will return an instance.- Specified by:
canBeInstantiatedin classTypeDescriptor<DecisionVariable>- Returns:
trueif this type can be instantiated from VIL/VTL,falseelse
-
create
public DecisionVariable create(java.lang.Object... params) throws VilException
Description copied from class:TypeDescriptorCreates an instance of the type according to the given parameters.- Specified by:
createin classTypeDescriptor<DecisionVariable>- Parameters:
params- the parameters- Returns:
- the created instance
- Throws:
VilException- in case that the creation does not work
-
isAssignableFrom
public boolean isAssignableFrom(IMetaType type)
Description copied from interface:IMetaTypeReturns whether this type is the same or a super class oftype.- Parameters:
type- the descriptor to be tested- Returns:
trueif both types are assignment compatible,falseelse
-
isCollection
public boolean isCollection()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL collection, i.e., set, sequence or collection.- Specified by:
isCollectionin classTypeDescriptor<DecisionVariable>- Returns:
trueif this is a VIL collection,falseelse
-
isSet
public boolean isSet()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL set.- Specified by:
isSetin classTypeDescriptor<DecisionVariable>- Returns:
trueif this is a VIL set,falseelse
-
isSequence
public boolean isSequence()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL sequence.- Specified by:
isSequencein classTypeDescriptor<DecisionVariable>- Returns:
trueif this is a VIL sequence,falseelse
-
isIterator
public boolean isIterator()
Description copied from class:TypeDescriptorReturns whether this descriptor represents an iterator.- Specified by:
isIteratorin classTypeDescriptor<DecisionVariable>- Returns:
trueif this is an iterator,falseelse
-
isMap
public boolean isMap()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL map.- Specified by:
isMapin classTypeDescriptor<DecisionVariable>- Returns:
trueif this is a VIL map,falseelse
-
getSuperType
public IMetaType getSuperType()
Description copied from interface:IMetaTypeReturns the type this type is refined from.- Returns:
- the super type or null if there is none
-
getRefines
AbstractIvmlTypeDescriptor getRefines()
Returns the type descriptor which is refined by this descriptor.- Returns:
- the refined type (may be null if there is none)
-
setRefines
protected void setRefines(AbstractIvmlTypeDescriptor refines)
Changes the type descriptor which is refined by this descriptor.- Parameters:
refines- the refined type descriptor (may be null if there is none)
-
isActualTypeOf
public boolean isActualTypeOf(IMetaType type)
Description copied from interface:IMetaTypeReturns whether this type can act as an actual type oftype.- Parameters:
type- the type to be checked- Returns:
trueif this type can act as an actual type oftype,falseelse- See Also:
IActualTypeProvider
-
getIvmlType
protected abstract IDatatype getIvmlType()
Returns the underlying IVML type.- Returns:
- the type
-
isEqual
protected boolean isEqual(AbstractIvmlTypeDescriptor d1, AbstractIvmlTypeDescriptor d2)
Returns whether two IVML type descriptors are considered to be equal.- Parameters:
d1- the first descriptord2- the second descriptor- Returns:
truefor type equality,falseelse
-
getDefaultValue
public java.lang.Object getDefaultValue()
Description copied from class:TypeDescriptorReturns the default value for this type, usually a neutral value or a constant value to compare against.- Overrides:
getDefaultValuein classTypeDescriptor<DecisionVariable>- Returns:
- the default value, null for none - may lead to an undefined operation execution
-
-