Class AbstractSimulinkModel
- java.lang.Object
-
- org.eclipse.epsilon.eol.models.Model
-
- org.eclipse.epsilon.eol.models.CachedModel<ISimulinkModelElement>
-
- org.eclipse.epsilon.emc.simulink.model.AbstractSimulinkModel
-
- All Implemented Interfaces:
AutoCloseable
,IGenericSimulinkModel
,IModel
- Direct Known Subclasses:
SimulinkDictionaryModel
,SimulinkModel
,SimulinkRequirementModel
public abstract class AbstractSimulinkModel extends CachedModel<ISimulinkModelElement> implements IGenericSimulinkModel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.epsilon.eol.models.IModel
IModel.AmbiguityCheckResult
-
-
Field Summary
-
Fields inherited from class org.eclipse.epsilon.eol.models.CachedModel
allContentsCache, kindCache, PROPERTY_CACHED, PROPERTY_CONCURRENT, typeCache
-
Fields inherited from class org.eclipse.epsilon.eol.models.Model
aliases, ENV_PREFIX, name, PROPERTY_ALIASES, PROPERTY_NAME, PROPERTY_READONLOAD, PROPERTY_READONLY, PROPERTY_STOREONDISPOSAL, propertyGetter, propertySetter, readOnLoad, storeOnDisposal
-
-
Constructor Summary
Constructors Constructor Description AbstractSimulinkModel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addPath(File path)
void
addPath(String path)
protected abstract void
closeMatlabModel()
protected ISimulinkModelElement
createInstanceInModel(String type)
protected void
disposeModel()
void
flush()
protected Collection<String>
getAllTypeNamesOf(Object instance)
Returns the fully qualified names of every type to which the given object conforms.protected Object
getCacheKeyForType(String type)
Returns an identity for the given type, which will be used byCachedModel
as a key for the memoization of model elements by type.MatlabEngine
getEngine()
String
getEngineJarPath()
Object
getEnumerationValue(String enumeration, String label)
File
getFile()
String
getLibraryPath()
String
getMatlabPath()
List<String>
getPaths()
File
getProject()
File
getWorkingDir()
Object
getWorkspaceVariable(String value)
Boolean
isCloseOnDispose()
boolean
isEnableTryCatch()
boolean
isInstantiable(String type)
boolean
isLoaded()
Convenience method for determining when a model has been loaded.Boolean
isOpenOnLoad()
boolean
isReduceExchanges()
boolean
isTrackApi()
Boolean
isUseCurrentProject()
void
load(StringProperties properties, IRelativePathResolver resolver)
protected void
loadModel()
boolean
owns(Object instance)
Used to test whether an object is contained in this model.Object
parseMatlabEngineVariable(String variableName)
protected boolean
resolvePaths()
void
setCloseOnDispose(Boolean closeOnDispose)
void
setEnableTryCatch(boolean enableTryCatch)
void
setEngine(MatlabEngine engine)
void
setEngineJarPath(String engineJarPath)
void
setFile(File file)
void
setLibraryPath(String libraryPath)
void
setMatlabPath(String matlabPath)
void
setOpenOnLoad(Boolean openOnLoad)
void
setProject(File simulinkProject)
void
setProject(String simulinkProject)
void
setReduceExchanges(boolean reduceExchanges)
void
setTrackApi(boolean track)
void
setUseCurrentProject(Boolean currentSimulinkProject)
void
setWorkingDir(File workingDir)
void
statement(String statement)
Object
statementWithResult(String statement)
-
Methods inherited from class org.eclipse.epsilon.eol.models.CachedModel
addToCache, allContents, allContentsFromModel, clearCache, createInstance, deleteElement, deleteElementInModel, dispose, getAllOfKind, getAllOfKindFromModel, getAllOfKindOrType, getAllOfType, getAllOfTypeFromModel, initCaches, isCachingEnabled, isConcurrent, load, removeFromCache, setCachingEnabled, setConcurrent, wrap
-
Methods inherited from class org.eclipse.epsilon.eol.models.Model
allInstances, createInstance, getAliases, getFullyQualifiedTypeNameOf, getMetamodel, getName, getPropertyGetter, getPropertySetter, getTransactionSupport, getTypeOf, isModelElement, isOfKind, isOfType, isPropertySet, isReadOnLoad, isStoredOnDisposal, knowsAboutProperty, load, load, setName, setReadOnLoad, setStoredOnDisposal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.epsilon.eol.models.IModel
allContents, checkAmbiguity, close, createInstance, createInstance, deleteElement, dispose, getAliases, getAllOfKind, getAllOfType, getElementById, getElementId, getFullyQualifiedTypeNameOf, getMetamodel, getName, getPropertyGetter, getPropertySetter, getTransactionSupport, getTypeNameOf, getTypeOf, hasType, isModelElement, isOfKind, isOfType, isPropertySet, isReadOnLoad, isStoredOnDisposal, knowsAboutProperty, load, load, load, setElementId, setName, setReadOnLoad, setStoredOnDisposal, store, store
-
-
-
-
Field Detail
-
PROPERTY_WORKING_DIR
public static final String PROPERTY_WORKING_DIR
- See Also:
- Constant Field Values
-
PROPERTY_PATHS
public static final String PROPERTY_PATHS
- See Also:
- Constant Field Values
-
PROPERTY_FILE
public static final String PROPERTY_FILE
- See Also:
- Constant Field Values
-
PROPERTY_MATLAB_PATH
public static final String PROPERTY_MATLAB_PATH
- See Also:
- Constant Field Values
-
PROPERTY_LIBRARY_PATH
public static final String PROPERTY_LIBRARY_PATH
- See Also:
- Constant Field Values
-
PROPERTY_ENGINE_JAR_PATH
public static final String PROPERTY_ENGINE_JAR_PATH
- See Also:
- Constant Field Values
-
PROPERTY_SIMULINK_PROJECT
public static final String PROPERTY_SIMULINK_PROJECT
- See Also:
- Constant Field Values
-
PROPERTY_OPEN_ON_LOAD
public static final String PROPERTY_OPEN_ON_LOAD
- See Also:
- Constant Field Values
-
PROPERTY_CLOSE_ON_DISPOSE
public static final String PROPERTY_CLOSE_ON_DISPOSE
- See Also:
- Constant Field Values
-
PROPERTY_ENABLE_TRY_CATCH
public static final String PROPERTY_ENABLE_TRY_CATCH
- See Also:
- Constant Field Values
-
PROPERTY_CURRENT_SIMULINK_PROJECT
public static final String PROPERTY_CURRENT_SIMULINK_PROJECT
- See Also:
- Constant Field Values
-
PROPERTY_ENGINE_POOL_SIZE
public static final String PROPERTY_ENGINE_POOL_SIZE
- See Also:
- Constant Field Values
-
PROPERTY_TRACK_API
public static final String PROPERTY_TRACK_API
- See Also:
- Constant Field Values
-
PROPERTY_REDUCE_EXCHANGES
public static final String PROPERTY_REDUCE_EXCHANGES
- See Also:
- Constant Field Values
-
ENV_MATLAB_PATH
public static final String ENV_MATLAB_PATH
- See Also:
- Constant Field Values
-
ENV_LIBRARY_PATH
public static final String ENV_LIBRARY_PATH
- See Also:
- Constant Field Values
-
ENV_ENGINE_JAR_PATH
public static final String ENV_ENGINE_JAR_PATH
- See Also:
- Constant Field Values
-
file
protected File file
-
matlabPath
protected String matlabPath
-
libraryPath
protected String libraryPath
-
engineJarPath
protected String engineJarPath
-
engine
protected MatlabEngine engine
-
simulinkProject
protected File simulinkProject
-
useCurrentProject
protected boolean useCurrentProject
-
openOnLoad
protected boolean openOnLoad
-
closeOnDispose
protected boolean closeOnDispose
-
enableTryCatch
protected boolean enableTryCatch
-
enginePoolSize
protected Integer enginePoolSize
-
workingDir
protected File workingDir
-
reduceExchanges
protected boolean reduceExchanges
-
-
Method Detail
-
flush
public void flush() throws EolRuntimeException
- Throws:
EolRuntimeException
-
loadModel
protected void loadModel() throws EolModelLoadingException
- Specified by:
loadModel
in classCachedModel<ISimulinkModelElement>
- Throws:
EolModelLoadingException
-
disposeModel
protected void disposeModel()
- Specified by:
disposeModel
in classCachedModel<ISimulinkModelElement>
-
closeMatlabModel
protected abstract void closeMatlabModel()
-
getCacheKeyForType
protected Object getCacheKeyForType(String type) throws EolModelElementTypeNotFoundException
Description copied from class:CachedModel
Returns an identity for the given type, which will be used byCachedModel
as a key for the memoization of model elements by type.- Specified by:
getCacheKeyForType
in classCachedModel<ISimulinkModelElement>
- Throws:
EolModelElementTypeNotFoundException
-
getAllTypeNamesOf
protected Collection<String> getAllTypeNamesOf(Object instance)
Description copied from class:CachedModel
Returns the fully qualified names of every type to which the given object conforms. The values are used by byCachedModel
for the memoization of model elements by their kind (CachedModel.getAllOfKind(String)
).- Specified by:
getAllTypeNamesOf
in classCachedModel<ISimulinkModelElement>
-
getEnumerationValue
public Object getEnumerationValue(String enumeration, String label) throws EolEnumerationValueNotFoundException
- Specified by:
getEnumerationValue
in interfaceIModel
- Throws:
EolEnumerationValueNotFoundException
-
getFile
public File getFile()
- Specified by:
getFile
in interfaceIGenericSimulinkModel
-
setFile
public void setFile(File file)
- Specified by:
setFile
in interfaceIGenericSimulinkModel
-
getEngine
public MatlabEngine getEngine()
- Specified by:
getEngine
in interfaceIGenericSimulinkModel
-
setEngine
public void setEngine(MatlabEngine engine)
-
getLibraryPath
public String getLibraryPath()
- Specified by:
getLibraryPath
in interfaceIGenericSimulinkModel
-
setLibraryPath
public void setLibraryPath(String libraryPath)
- Specified by:
setLibraryPath
in interfaceIGenericSimulinkModel
-
getEngineJarPath
public String getEngineJarPath()
- Specified by:
getEngineJarPath
in interfaceIGenericSimulinkModel
-
setEngineJarPath
public void setEngineJarPath(String engineJarPath)
- Specified by:
setEngineJarPath
in interfaceIGenericSimulinkModel
-
getMatlabPath
public String getMatlabPath()
- Specified by:
getMatlabPath
in interfaceIGenericSimulinkModel
-
setMatlabPath
public void setMatlabPath(String matlabPath)
- Specified by:
setMatlabPath
in interfaceIGenericSimulinkModel
-
setTrackApi
public void setTrackApi(boolean track)
- Specified by:
setTrackApi
in interfaceIGenericSimulinkModel
-
isTrackApi
public boolean isTrackApi()
- Specified by:
isTrackApi
in interfaceIGenericSimulinkModel
-
getProject
public File getProject()
- Specified by:
getProject
in interfaceIGenericSimulinkModel
-
setProject
public void setProject(String simulinkProject)
- Specified by:
setProject
in interfaceIGenericSimulinkModel
-
setProject
public void setProject(File simulinkProject)
-
isUseCurrentProject
public Boolean isUseCurrentProject()
- Specified by:
isUseCurrentProject
in interfaceIGenericSimulinkModel
-
setUseCurrentProject
public void setUseCurrentProject(Boolean currentSimulinkProject)
- Specified by:
setUseCurrentProject
in interfaceIGenericSimulinkModel
-
setCloseOnDispose
public void setCloseOnDispose(Boolean closeOnDispose)
- Specified by:
setCloseOnDispose
in interfaceIGenericSimulinkModel
-
setOpenOnLoad
public void setOpenOnLoad(Boolean openOnLoad)
- Specified by:
setOpenOnLoad
in interfaceIGenericSimulinkModel
-
isCloseOnDispose
public Boolean isCloseOnDispose()
- Specified by:
isCloseOnDispose
in interfaceIGenericSimulinkModel
-
isOpenOnLoad
public Boolean isOpenOnLoad()
- Specified by:
isOpenOnLoad
in interfaceIGenericSimulinkModel
-
setEnableTryCatch
public void setEnableTryCatch(boolean enableTryCatch)
-
isEnableTryCatch
public boolean isEnableTryCatch()
-
parseMatlabEngineVariable
public Object parseMatlabEngineVariable(String variableName) throws MatlabException
- Throws:
MatlabException
-
statement
public void statement(String statement) throws EolRuntimeException
- Throws:
EolRuntimeException
-
statementWithResult
public Object statementWithResult(String statement) throws EolRuntimeException
- Throws:
EolRuntimeException
-
owns
public boolean owns(Object instance)
Description copied from interface:IModel
Used to test whether an object is contained in this model.
-
isInstantiable
public boolean isInstantiable(String type)
- Specified by:
isInstantiable
in interfaceIModel
-
createInstanceInModel
protected ISimulinkModelElement createInstanceInModel(String type) throws EolModelElementTypeNotFoundException, EolNotInstantiableModelElementTypeException
- Specified by:
createInstanceInModel
in classCachedModel<ISimulinkModelElement>
- Throws:
EolModelElementTypeNotFoundException
EolNotInstantiableModelElementTypeException
-
load
public void load(StringProperties properties, IRelativePathResolver resolver) throws EolModelLoadingException
- Specified by:
load
in interfaceIModel
- Overrides:
load
in classCachedModel<ISimulinkModelElement>
- Throws:
EolModelLoadingException
-
isLoaded
public boolean isLoaded()
Description copied from class:CachedModel
Convenience method for determining when a model has been loaded.- Overrides:
isLoaded
in classCachedModel<ISimulinkModelElement>
- Returns:
- Whether the cache has been populated.
- Since:
- 1.6
-
getWorkingDir
public File getWorkingDir()
- Specified by:
getWorkingDir
in interfaceIGenericSimulinkModel
-
setWorkingDir
public void setWorkingDir(File workingDir)
- Specified by:
setWorkingDir
in interfaceIGenericSimulinkModel
-
addPath
public void addPath(String path)
- Specified by:
addPath
in interfaceIGenericSimulinkModel
-
addPath
public void addPath(File path)
- Specified by:
addPath
in interfaceIGenericSimulinkModel
-
getPaths
public List<String> getPaths()
- Specified by:
getPaths
in interfaceIGenericSimulinkModel
-
resolvePaths
protected boolean resolvePaths()
- Returns:
true
iff the paths were successfully resolved.
-
isReduceExchanges
public boolean isReduceExchanges()
-
setReduceExchanges
public void setReduceExchanges(boolean reduceExchanges)
-
-