Class DummyModel<V extends IMetaParameterDeclaration,M extends IModel>
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.common.DummyModel<V,M>
-
- Type Parameters:
V- the variable declaration typeM- the model type
- All Implemented Interfaces:
IModel,IModelData,IParameterizable<V>,IResolvableModel<V,M>,IMetaType,ITypedModel
class DummyModel<V extends IMetaParameterDeclaration,M extends IModel> extends java.lang.Object implements IResolvableModel<V,M>
Implements a dummy model used for properly initializingRuntimeEnvironment.- Author:
- Holger Eichelberger
-
-
Constructor Summary
Constructors Constructor Description DummyModel()Prevents external instantiation (singleton).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IMetaOperationaddPlaceholderOperation(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.voidaddRuntimeImport(ModelImport<M> imp)Adds a runtime model import.booleancheckConversion(IMetaType param, IMetaOperation conversion)Checks a conversion from this type toparamvia the givenconversion.voiddispose()Shall be called at the end of the lifetime of the model in order to clean up references such as listeners.booleanenableDynamicDispatch()Returns whether this type enables dynamic dispatch of operations.IMetaOperationfindConversion(IMetaType sourceType, IMetaType targetType)Returns the conversion operation from this type to target type (if there is any).IMetaTypegetBaseType()Returns the base type (in case of IVML derived types).java.util.List<IMetaOperation>getCandidates(java.lang.String name, int unnamedArgsCount)Returns operation candidates matching the given name and number of unnamed (required) arguments.CompoundgetCompound(int index)Get the compound at the specified index.CompoundgetCompound(java.lang.String name)Returns the compound declaration with given name.intgetCompoundCount()Get the number of compounds defined in this model.IMetaTypegetExtensionType(int index)Returns the specified extension type.intgetExtensionTypesCount()Returns the number of extension types declared in/by this model.IMetaFieldgetField(int index)Returns the specified field.intgetFieldCount()Returns the number of fields provided by this type.intgetGenericParameterCount()Returns the number of generic type parameters.TypeDescriptor<?>getGenericParameterType(int index)Returns the specified generic parameter type.ModelImport<?>getImport(int index)Returns the model import specified byindex.intgetImportsCount()Returns the number of imports.IndentationConfigurationgetIndentationConfiguration()Returns the indentation configuration for this model.java.lang.ObjectgetIvmlElement(java.lang.String name)Returns whether the givennameresolves to an IVML element.java.lang.StringgetName()Returns the name of the model element.IMetaOperationgetOperation(int index)Returns the specified operation.intgetOperationsCount()Returns the number of operations provided by this type.VgetParameter(int index)Get the parameter of this rule at the specified index.VgetParameter(java.lang.String name)Returns a named parameter declaration.intgetParameterCount()Get the number of parameters of this rule.IResolvableModel<V,M>getParent()Get the parent project which this project extends.java.lang.StringgetQualifiedName()Returns the qualified name of this type.intgetRequiredParameterCount()Returns the number of required parameters, i.e., non-default and non-named parameters.IRestrictionEvaluationContextgetRestrictionEvaluationContext()Returns the context for evaluating import / conflict restrictions.ModelImport<?>getSuper()Returns the reference to the super model (if it exists).IMetaTypegetSuperType()Returns the type this type is refined from.TypedefgetTypedef(int index)Get the typedef at the specified index.TypedefgetTypedef(java.lang.String name)Returns the typedef with given name.intgetTypedefCount()Get the number of typedefs of this model.TypeRegistrygetTypeRegistry()Returns the responsible type registry.VgetVariableDeclaration(int index)Get the variable declaration of this model at the specified index.intgetVariableDeclarationCount()Get the number of variable declaration of this model.VersiongetVersion()Returns the version of this model.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.booleanisImplicit(IMetaParameterDeclaration decl)Returns whether a variable declaration is implicit (predefined).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.voidsetVersion(Version version)Changes the version of this model.
-
-
-
Method Detail
-
setVersion
public void setVersion(Version version)
Description copied from interface:IModelChanges the version of this model.- Specified by:
setVersionin interfaceIModel- Parameters:
version- Version to set
-
getVersion
public Version getVersion()
Description copied from interface:IModelReturns the version of this model.- Specified by:
getVersionin interfaceIModel- Specified by:
getVersionin interfaceIModelData- Returns:
- the version or
nullif no version is specified for this model.
-
getName
public java.lang.String getName()
Description copied from interface:IModelReturns the name of the model element.
-
getImportsCount
public int getImportsCount()
Description copied from interface:IModelReturns the number of imports.- Specified by:
getImportsCountin interfaceIModel- Returns:
- the number of imports
-
getImport
public ModelImport<?> getImport(int index)
Description copied from interface:IModelReturns the model import specified byindex.
-
getSuper
public ModelImport<?> getSuper()
Description copied from interface:IModelReturns the reference to the super model (if it exists).
-
getIndentationConfiguration
public IndentationConfiguration getIndentationConfiguration()
Description copied from interface:IModelReturns the indentation configuration for this model. The indentation configuration is considered to be immutable.- Specified by:
getIndentationConfigurationin interfaceIModel- Returns:
- the indentation configuration (disabled if null)
-
dispose
public void dispose()
Description copied from interface:IModelShall be called at the end of the lifetime of the model in order to clean up references such as listeners.
-
getRestrictionEvaluationContext
public IRestrictionEvaluationContext getRestrictionEvaluationContext()
Description copied from interface:IModelReturns the context for evaluating import / conflict restrictions. This context shall only contain the information that is necessary to evaluate restriction information.- Specified by:
getRestrictionEvaluationContextin interfaceIModel- Returns:
- the evaluation context
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface:IMetaTypeReturns the qualified name of this type.- Specified by:
getQualifiedNamein interfaceIMetaType- Returns:
- the qualified name
-
getOperationsCount
public int getOperationsCount()
Description copied from interface:IMetaTypeReturns the number of operations provided by this type.- Specified by:
getOperationsCountin interfaceIMetaType- Returns:
- the number of operations
-
getOperation
public IMetaOperation getOperation(int index)
Description copied from interface:IMetaTypeReturns the specified operation.- Specified by:
getOperationin interfaceIMetaType- Parameters:
index- the 0-based index of the operation to be returned- Returns:
- the specified operation
-
isAssignableFrom
public boolean isAssignableFrom(IMetaType type)
Description copied from interface:IMetaTypeReturns whether this type is the same or a super class oftype.- Specified by:
isAssignableFromin interfaceIMetaType- Parameters:
type- the descriptor to be tested- Returns:
trueif both types are assignment compatible,falseelse
-
findConversion
public IMetaOperation findConversion(IMetaType sourceType, IMetaType targetType)
Description copied from interface:IMetaTypeReturns the conversion operation from this type to target type (if there is any).- Specified by:
findConversionin interfaceIMetaType- Parameters:
sourceType- the source type to convert fromtargetType- the target type to convert to- Returns:
- the conversion operation as defined in the underlying implementation class, null if no matching can be found
-
isBasicType
public boolean isBasicType()
Description copied from interface:IMetaTypeReturns whether this instance represents a basic type.- Specified by:
isBasicTypein interfaceIMetaType- Returns:
trueif this instance represents a basic type,falseelse
-
getTypeRegistry
public TypeRegistry getTypeRegistry()
Description copied from interface:IResolvableModelReturns the responsible type registry.- Specified by:
getTypeRegistryin interfaceIMetaType- Specified by:
getTypeRegistryin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Returns:
- the type registry
-
enableDynamicDispatch
public boolean enableDynamicDispatch()
Description copied from interface:IMetaTypeReturns whether this type enables dynamic dispatch of operations.- Specified by:
enableDynamicDispatchin interfaceIMetaType- Returns:
trueif it enables dynamic dispatch,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 IMetaOperation addPlaceholderOperation(java.lang.String name, int parameterCount, boolean acceptsNamedParameters)
Description copied from interface:IMetaTypeAdds a placeholder operation, i.e., in case that the original operation cannot be resolved but the script shall remain executable.- Specified by:
addPlaceholderOperationin interfaceIMetaType- Parameters:
name- the name of the operationparameterCount- the number of parameters of the operationacceptsNamedParameters- whether the operation shall accept named parameters- Returns:
- the added operation, null if this type is not a
placeholder
-
isActualTypeOf
public boolean isActualTypeOf(IMetaType type)
Description copied from interface:IMetaTypeReturns whether this type can act as an actual type oftype.- Specified by:
isActualTypeOfin interfaceIMetaType- Parameters:
type- the type to be checked- Returns:
trueif this type can act as an actual type oftype,falseelse- See Also:
IActualTypeProvider
-
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
-
getFieldCount
public int getFieldCount()
Description copied from interface:IMetaTypeReturns the number of fields provided by this type.- Specified by:
getFieldCountin interfaceIMetaType- Returns:
- the number of fields
-
getField
public IMetaField getField(int index)
Description copied from interface:IMetaTypeReturns the specified field.
-
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
-
getSuperType
public IMetaType getSuperType()
Description copied from interface:IMetaTypeReturns the type this type is refined from.- Specified by:
getSuperTypein interfaceIMetaType- Returns:
- the super type or null if there is none
-
getGenericParameterCount
public int getGenericParameterCount()
Description copied from interface:IMetaTypeReturns the number of generic type parameters.- Specified by:
getGenericParameterCountin interfaceIMetaType- Returns:
- the number of generic type parameters
-
getGenericParameterType
public TypeDescriptor<?> getGenericParameterType(int index)
Description copied from interface:IMetaTypeReturns the specified generic parameter type.- Specified by:
getGenericParameterTypein interfaceIMetaType- Parameters:
index- the index of the parameter type to return- Returns:
- the specified parameter 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
-
getParameterCount
public int getParameterCount()
Description copied from interface:IParameterizableGet the number of parameters of this rule.- Specified by:
getParameterCountin interfaceIParameterizable<V extends IMetaParameterDeclaration>- Returns:
- The number of parameters of this rule.
-
getParameter
public V getParameter(int index)
Description copied from interface:IParameterizableGet the parameter of this rule at the specified index.- Specified by:
getParameterin interfaceIParameterizable<V extends IMetaParameterDeclaration>- Parameters:
index- The 0-based index of the rule parameter to be returned.- Returns:
- The rule parameter at the given index.
-
getRequiredParameterCount
public int getRequiredParameterCount()
Description copied from interface:IParameterizableReturns the number of required parameters, i.e., non-default and non-named parameters.- Specified by:
getRequiredParameterCountin interfaceIParameterizable<V extends IMetaParameterDeclaration>- Returns:
- the number of required parameters
-
getParameter
public V getParameter(java.lang.String name)
Description copied from interface:IParameterizableReturns a named parameter declaration.- Specified by:
getParameterin interfaceIParameterizable<V extends IMetaParameterDeclaration>- Parameters:
name- the name of the parameter- Returns:
- the declaration or null if there is none
-
getIvmlElement
public java.lang.Object getIvmlElement(java.lang.String name)
Description copied from interface:IResolvableModelReturns whether the givennameresolves to an IVML element.- Specified by:
getIvmlElementin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
name- the name to be resolved- Returns:
- the IVML element (value, containable model element), null else
-
getParent
public IResolvableModel<V,M> getParent()
Description copied from interface:IResolvableModelGet the parent project which this project extends.- Specified by:
getParentin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Returns:
- The parent project of this project or
nullif no parent is defined for this project.
-
getExtensionTypesCount
public int getExtensionTypesCount()
Description copied from interface:IResolvableModelReturns the number of extension types declared in/by this model.- Specified by:
getExtensionTypesCountin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Returns:
- the number of extension types
-
getExtensionType
public IMetaType getExtensionType(int index)
Description copied from interface:IResolvableModelReturns the specified extension type.- Specified by:
getExtensionTypein interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
index- the 0-based index of the extension type to be returned- Returns:
- the specified extension type
-
getVariableDeclarationCount
public int getVariableDeclarationCount()
Description copied from interface:IResolvableModelGet the number of variable declaration of this model.- Specified by:
getVariableDeclarationCountin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Returns:
- The number of variable declaration of this model.
-
getVariableDeclaration
public V getVariableDeclaration(int index)
Description copied from interface:IResolvableModelGet the variable declaration of this model at the specified index.- Specified by:
getVariableDeclarationin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
index- The 0-based index of the variable declaration to be returned.- Returns:
- The variable declaration at the given index.
-
isImplicit
public boolean isImplicit(IMetaParameterDeclaration decl)
Description copied from interface:IResolvableModelReturns whether a variable declaration is implicit (predefined).- Specified by:
isImplicitin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
decl- the declaration to be tested- Returns:
trueif it is implicit,falseelse
-
getTypedefCount
public int getTypedefCount()
Description copied from interface:IResolvableModelGet the number of typedefs of this model.- Specified by:
getTypedefCountin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Returns:
- The number of typedefs of this model.
-
getTypedef
public Typedef getTypedef(int index)
Description copied from interface:IResolvableModelGet the typedef at the specified index.- Specified by:
getTypedefin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
index- The 0-based index of the typedef to be returned.- Returns:
- The typedef parameter at the given index.
-
addRuntimeImport
public void addRuntimeImport(ModelImport<M> imp)
Description copied from interface:IResolvableModelAdds a runtime model import.- Specified by:
addRuntimeImportin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
imp- the import
-
getCandidates
public java.util.List<IMetaOperation> getCandidates(java.lang.String name, int unnamedArgsCount)
Description copied from interface:IMetaTypeReturns operation candidates matching the given name and number of unnamed (required) arguments.- Specified by:
getCandidatesin interfaceIMetaType- Parameters:
name- the name of the operationunnamedArgsCount- the number of unnamed arguments- Returns:
- the operation candidates
-
getTypedef
public Typedef getTypedef(java.lang.String name)
Description copied from interface:IResolvableModelReturns the typedef with given name.- Specified by:
getTypedefin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
name- the name- Returns:
- the typedef (may be null for none)
-
getCompoundCount
public int getCompoundCount()
Description copied from interface:IResolvableModelGet the number of compounds defined in this model.- Specified by:
getCompoundCountin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Returns:
- The number of compounds of this model.
-
getCompound
public Compound getCompound(int index)
Description copied from interface:IResolvableModelGet the compound at the specified index.- Specified by:
getCompoundin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
index- The 0-based index of the compound to be returned.- Returns:
- The compound at the given index.
-
getCompound
public Compound getCompound(java.lang.String name)
Description copied from interface:IResolvableModelReturns the compound declaration with given name.- Specified by:
getCompoundin interfaceIResolvableModel<V extends IMetaParameterDeclaration,M extends IModel>- Parameters:
name- the name- Returns:
- the compound (may be null for none)
-
-