Class IvmlProjectTypeDescriptor
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<DecisionVariable>
-
- net.ssehub.easy.instantiation.core.model.vilTypes.configuration.AbstractIvmlTypeDescriptor
-
- net.ssehub.easy.instantiation.core.model.vilTypes.configuration.IvmlProjectTypeDescriptor
-
- All Implemented Interfaces:
IActualTypeAssignmentProvider,IActualValueProvider,IMetaType
public class IvmlProjectTypeDescriptor extends AbstractIvmlTypeDescriptor implements IActualValueProvider, IActualTypeAssignmentProvider
Implements a dynamic type descriptor for a project containing IVML decision variables. Instances of this class represent IVML types and act as a frontend forConfiguration, thus, it is assignable toConfiguration.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Projectproject-
Fields inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor
EMPTY
-
-
Constructor Summary
Constructors Constructor Description IvmlProjectTypeDescriptor()For serialization.IvmlProjectTypeDescriptor(Project project, IvmlTypeResolver resolver)Creates a new type descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddOperations(java.util.Map<java.lang.String,OperationDescriptor> operations, java.util.Map<java.lang.String,FieldDescriptor> fields, Project project, java.util.Set<Project> done)Adds all operations ofprojectand its imports tooperations.private voidaddOperations(DecisionVariableDeclaration decl, java.util.Map<java.lang.String,OperationDescriptor> operations, java.util.Map<java.lang.String,FieldDescriptor> fields)Adds operations for the given variable declaration.private voidaddOperations(IDecisionVariableContainer cont, java.util.Map<java.lang.String,OperationDescriptor> operations, java.util.Map<java.lang.String,FieldDescriptor> fields)Adds operations for elements defined bycont.OperationDescriptoraddPlaceholderOperation(java.lang.String name, int parameterCount, boolean acceptsNamedParameters)Adds a placeholder operation, i.e., in case that the original operation cannot be resolved but the script shall remain executable.booleancheckConversion(IMetaType param, IMetaOperation conversion)Checks a conversion from this type toparamvia the givenconversion.java.lang.ObjectdetermineActualValue(java.lang.Object object)Determines a more actual value forobjectin the context of using it for this type.IMetaTypegetBaseType()Returns the base type (in case of IVML derived types).protected IDatatypegetIvmlType()Returns the underlying IVML type.ProjectgetProject()Returns the project associated with this descriptor.booleanisAssignableFrom(IMetaType type1, IMetaType type2)Returns whether type1 is a super class of or equal totype2.booleanisAssignableFrom(TypeDescriptor<?> desc)Returns whether this descriptor is the same or a super class ofdesc.booleanisInstance(java.lang.Object object)Returns whether the givenobjectis an instance of this descriptor.booleanisInstantiator()Returns whether this type is an instantiator.booleanisInternal()Returns whether this type is internal and shall not be visible to the user.booleanisPlaceholder()Returns whether this type is valid or whether it is a placeholder type in case that the original type cannot be resolved but the script shall remain executable.booleanisSameType(java.lang.Object object)Returns whether the givenobjectof of the type of this descriptor.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.configuration.AbstractIvmlTypeDescriptor
addAttributeFields, addComparisonOperations, addConversionOperations, addDecisionVariableOperations, canBeInstantiated, create, getDefaultValue, getRefines, getSuperType, getTypeClass, getTypeRegistry, isActualTypeOf, isAssignableFrom, isBasicType, isCollection, isEqual, isIterator, isMap, isSequence, isSet, setRefines
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor
addOperation, 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, isFieldsNull, isInitialized, isNameSet, isSame, setConversions, setFields, setFields, setName, setOperations, toString
-
-
-
-
Field Detail
-
project
private Project project
-
-
Constructor Detail
-
IvmlProjectTypeDescriptor
IvmlProjectTypeDescriptor() throws VilExceptionFor serialization.- Throws:
VilException- shall not occur
-
IvmlProjectTypeDescriptor
IvmlProjectTypeDescriptor(Project project, IvmlTypeResolver resolver) throws VilException
Creates a new type descriptor. Overridden constructors shall callTypeDescriptor.setOperations(java.util.Collection)andTypeDescriptor.setConversions(java.util.Collection).- Parameters:
project- the project to create the descriptor forresolver- for retrieving further IVML types- Throws:
VilException- if analyzing the class fails for some reason
-
-
Method Detail
-
addOperations
private void addOperations(DecisionVariableDeclaration decl, java.util.Map<java.lang.String,OperationDescriptor> operations, java.util.Map<java.lang.String,FieldDescriptor> fields)
Adds operations for the given variable declaration.- Parameters:
decl- the variable declarationoperations- the name-operation mapping to be filled as a side effectfields- the name-field mapping to be filled as a side effect
-
addOperations
private void addOperations(IDecisionVariableContainer cont, java.util.Map<java.lang.String,OperationDescriptor> operations, java.util.Map<java.lang.String,FieldDescriptor> fields)
Adds operations for elements defined bycont.- Parameters:
cont- the containeroperations- the name-operation mapping to be filled as a side effectfields- the name-field mapping to be filled as a side effect
-
addOperations
private void addOperations(java.util.Map<java.lang.String,OperationDescriptor> operations, java.util.Map<java.lang.String,FieldDescriptor> fields, Project project, java.util.Set<Project> done)
Adds all operations ofprojectand its imports tooperations.- Parameters:
operations- the name-operation mapping to be filled as a side effectfields- the name-field mapping to be filled as a side effectproject- the project the operations shall be added fordone- already done projects
-
getProject
public Project getProject()
Returns the project associated with this descriptor.- Returns:
- the project
-
isAssignableFrom
public boolean isAssignableFrom(TypeDescriptor<?> desc)
Description copied from class:TypeDescriptorReturns whether this descriptor is the same or a super class ofdesc.- Specified by:
isAssignableFromin classTypeDescriptor<DecisionVariable>- Parameters:
desc- the descriptor to be tested- Returns:
trueif both descriptors are assignment compatible,falseelse
-
isAssignableFrom
public boolean isAssignableFrom(IMetaType type1, IMetaType type2)
Description copied from interface:IActualTypeAssignmentProviderReturns whether type1 is a super class of or equal totype2.- Specified by:
isAssignableFromin interfaceIActualTypeAssignmentProvider- Parameters:
type1- the first type to checktype2- the second type to check- Returns:
trueif assignable,falseelse
-
isInstance
public boolean isInstance(java.lang.Object object)
Description copied from class:TypeDescriptorReturns whether the givenobjectis an instance of this descriptor.- Specified by:
isInstancein classTypeDescriptor<DecisionVariable>- Parameters:
object- the object to be checked- Returns:
trueif it is an instance,falseelse
-
isSameType
public boolean isSameType(java.lang.Object object)
Description copied from class:TypeDescriptorReturns whether the givenobjectof of the type of this descriptor.- Specified by:
isSameTypein classTypeDescriptor<DecisionVariable>- Parameters:
object- the object to be checked- Returns:
trueifobjecthas the same type,falseelse
-
isPlaceholder
public boolean isPlaceholder()
Description copied from interface:IMetaTypeReturns whether this type is valid or whether it is a placeholder type in case that the original type cannot be resolved but the script shall remain executable.- Specified by:
isPlaceholderin interfaceIMetaType- Returns:
trueif this type is a placeholder,falseelse
-
addPlaceholderOperation
public OperationDescriptor addPlaceholderOperation(java.lang.String name, int parameterCount, boolean acceptsNamedParameters)
Description copied from class:TypeDescriptorAdds a placeholder operation, i.e., in case that the original operation cannot be resolved but the script shall remain executable.- Specified by:
addPlaceholderOperationin interfaceIMetaType- Specified by:
addPlaceholderOperationin classTypeDescriptor<DecisionVariable>- Parameters:
name- the name of the operationparameterCount- the number of parameters of the operationacceptsNamedParameters- whether the operation accepts named parameters- Returns:
- the added operation, null if this type is not a
placeholder
-
determineActualValue
public java.lang.Object determineActualValue(java.lang.Object object)
Description copied from interface:IActualValueProviderDetermines a more actual value forobjectin the context of using it for this type. Default types implementing this interface shall not use their attributes as this method will be called via a template object.- Specified by:
determineActualValuein interfaceIActualValueProvider- Parameters:
object- the initial object (may be null)- Returns:
- the actual object (may be
objectif no actual value is available, may be null ifobjectwas null)
-
getBaseType
public IMetaType getBaseType()
Description copied from interface:IMetaTypeReturns the base type (in case of IVML derived types).- Specified by:
getBaseTypein interfaceIMetaType- Returns:
- the base type or null
-
isInternal
public boolean isInternal()
Description copied from interface:IMetaTypeReturns whether this type is internal and shall not be visible to the user.- Specified by:
isInternalin interfaceIMetaType- Returns:
trueif this type is internal,falseelse
-
isInstantiator
public boolean isInstantiator()
Description copied from class:TypeDescriptorReturns whether this type is an instantiator.- Specified by:
isInstantiatorin classTypeDescriptor<DecisionVariable>- Returns:
trueif it is an instantiator,falseelse
-
getIvmlType
protected IDatatype getIvmlType()
Description copied from class:AbstractIvmlTypeDescriptorReturns the underlying IVML type.- Specified by:
getIvmlTypein classAbstractIvmlTypeDescriptor- Returns:
- the type
-
checkConversion
public boolean checkConversion(IMetaType param, IMetaOperation conversion)
Description copied from interface:IMetaTypeChecks a conversion from this type toparamvia the givenconversion.- Specified by:
checkConversionin interfaceIMetaType- Parameters:
param- the original parameter valueconversion- the conversion function- Returns:
trueif ok,falseelse
-
-