Package org.eclipse.epsilon.emg
Class EmgModule
- All Implemented Interfaces:
IModule
,ModuleElement
,IEmgModule
,IEolModule
,IEplModule
,IErlModule
The Emg Module is responsible for execution emg scripts. Emg scripts are used
to generate models.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.epsilon.epl.AbstractEplModule
AbstractEplModule.LazyAdvancedRoleInstancesInitializer, AbstractEplModule.LazyBasicRoleInstancesInitializer
-
Field Summary
Fields inherited from class org.eclipse.epsilon.epl.AbstractEplModule
declaredPatterns, INFINITE, maxLoops, patternMatchModelName, patterns, repeatWhileMatchesFound
Fields inherited from class org.eclipse.epsilon.erl.ErlModule
declaredPost, declaredPre, post, pre
Fields inherited from class org.eclipse.epsilon.eol.EolModule
context, declaredModelDeclarations, declaredOperations, imports, main, modelDeclarations, operations, postOperationStatements
Fields inherited from class org.eclipse.epsilon.eol.AbstractModule
parseProblems, parser, sourceFile, sourceUri
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
containAny
(Collection<Object> first, Collection<Object> last) Contain any.protected void
Execute the create operations in the EMG script.protected double
Gets the float.protected int
Gets the int.This method provides the main high-level execution logic for EPL.protected void
Main rule processing logic.void
setSeed
(long seed) void
setUseSeed
(boolean useSeed) Methods inherited from class org.eclipse.epsilon.epl.EplModule
createCombinationGenerator, getCandidates, initGenerator, wrapAdvancedRoleInstances, wrapBasicRoleInstances
Methods inherited from class org.eclipse.epsilon.epl.AbstractEplModule
adapt, build, createLexer, createModel, createParser, createPatternMatch, executeDoBlock, filterElements, flatMapRoleBindings, getContext, getDeclaredPatterns, getMainRule, getMatchResult, getMaxLoops, getPatterns, getRoleInstances, getVariables, isRepeatWhileMatches, isValidCombination, matchCombination, matchPatterns, matchPatterns, negativeGuard, postProcessMatches, preMatch, putRoleBindingsIntoFrame, setMaxLoops, setRepeatWhileMatches
Methods inherited from class org.eclipse.epsilon.erl.ErlModule
calculateSuperRules, execute, execute, executeImpl, getDeclaredPost, getDeclaredPre, getPost, getPre, postExecution, prepareExecution
Methods inherited from class org.eclipse.epsilon.eol.EolModule
checkImports, clearCache, execute, getDeclaredModelDeclarations, getDeclaredOperations, getImportManager, getImports, getImportsByExtension, getMain, getModelDeclarations, getOperations, getParentModule, getPostOperationStatements, setContext, setImportManager, setMain, setParentModule, toString
Methods inherited from class org.eclipse.epsilon.eol.AbstractModule
assignAnnotations, assignComment, assignComments, createAst, extractComments, getParseProblems, getSourceFile, getSourceUri, invokeMainRule, parse, parse
Methods inherited from class org.eclipse.epsilon.common.module.AbstractModuleElement
equals, getChildren, getComments, getData, getDebugInfo, getFile, getModule, getParent, getRegion, getUri, hashCode, setModule, setParent, setRegion, setUri
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.epsilon.eol.IEolModule
configure, execute, getConfigurationProperties, getDeclaredModelDeclarations, getDeclaredOperations, getImportManager, getImports, getMain, getModelDeclarations, getOperations, getParentModule, getParseProblems, getPostOperationStatements, parse, setContext, setImportManager, setParentModule
Methods inherited from interface org.eclipse.epsilon.epl.IEplModule
getDeclaredPatterns, getMaximumLevel, getMaxLoops, getPatterns, isRepeatWhileMatches, matchPatterns, setMaxLoops, setRepeatWhileMatches
Methods inherited from interface org.eclipse.epsilon.erl.IErlModule
getContext, getDeclaredPost, getDeclaredPre, getPost, getPre
Methods inherited from interface org.eclipse.epsilon.common.module.IModule
createAst, getSourceUri, parse, parse, parse, parse, parse
Methods inherited from interface org.eclipse.epsilon.common.module.ModuleElement
build, getChildren, getComments, getData, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUri
-
Constructor Details
-
EmgModule
public EmgModule()
-
-
Method Details
-
setSeed
public void setSeed(long seed) - Specified by:
setSeed
in interfaceIEmgModule
- Parameters:
seed
- the seed to set
-
setUseSeed
public void setUseSeed(boolean useSeed) - Specified by:
setUseSeed
in interfaceIEmgModule
- Parameters:
useSeed
- the useSeed to set
-
getNamedCreatedObjects
- Specified by:
getNamedCreatedObjects
in interfaceIEmgModule
- Returns:
- the namedCreatedObjects
-
getImportConfiguration
- Overrides:
getImportConfiguration
in classAbstractEplModule
-
prepareContext
- Overrides:
prepareContext
in classEolModule
- Throws:
EolRuntimeException
-
processRules
Description copied from class:ErlModule
Main rule processing logic. Non-abstract for compatibility.- Overrides:
processRules
in classAbstractEplModule
- Returns:
- The result of executing this module.
- Throws:
EolRuntimeException
-
executeCreateOperations
Execute the create operations in the EMG script.- Throws:
EolModelElementTypeNotFoundException
- the eol model element type not found exceptionEolRuntimeException
- If the type to be instantiated can't be found or any of the random functions fails.
-
match
Description copied from class:AbstractEplModule
This method provides the main high-level execution logic for EPL. The idea is that for each role in the pattern, appropriate bindings are made to the role and executed. Then the match block (and subsequently onMatch) is executed for the role and a PatternMatch is created where applicable.
In essence, this method can be thought of as the executor of all roles in the pattern, and therefore acts as a bridge between the high-level methods (e.g.AbstractEplModule.matchPatterns(int, PatternMatchModel)
) and the low-level ones (e.g.AbstractEplModule.getRoleInstances(Role, String)
).
Implementation-wise, this method delegates the main execution logic toAbstractEplModule.matchCombination(Collection, Pattern)
, and so the sole responsibility of this method is to loop through the combinations returned byAbstractEplModule.getCandidates(Pattern)
and collect all the results. Subclasses may override this method to alter the type of collection returned and/or alter the looping mechanism.- Specified by:
match
in interfaceIEplModule
- Overrides:
match
in classAbstractEplModule
- Throws:
EolRuntimeException
-
getInt
Gets the int.- Parameters:
object
- the object- Returns:
- the int
-
getFloat
Gets the float.- Parameters:
object
- the object- Returns:
- the float
-
containAny
Contain any.- Parameters:
first
- the firstlast
- the last- Returns:
- true, if successful
-