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, repeatWhileMatchesFoundFields inherited from class org.eclipse.epsilon.erl.ErlModule
declaredPost, declaredPre, post, preFields inherited from class org.eclipse.epsilon.eol.EolModule
context, declaredModelDeclarations, declaredOperations, imports, main, modelDeclarations, operations, postOperationStatementsFields inherited from class org.eclipse.epsilon.eol.AbstractModule
parseProblems, parser, sourceFile, sourceUri -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancontainAny(Collection<Object> first, Collection<Object> last) Contain any.protected voidExecute the create operations in the EMG script.protected doubleGets the float.protected intGets the int.This method provides the main high-level execution logic for EPL.protected voidMain rule processing logic.voidsetSeed(long seed) voidsetUseSeed(boolean useSeed) Methods inherited from class org.eclipse.epsilon.epl.EplModule
createCombinationGenerator, getCandidates, initGenerator, wrapAdvancedRoleInstances, wrapBasicRoleInstancesMethods 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, setRepeatWhileMatchesMethods inherited from class org.eclipse.epsilon.erl.ErlModule
calculateSuperRules, execute, execute, executeImpl, getDeclaredPost, getDeclaredPre, getPost, getPre, postExecution, prepareExecutionMethods 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, toStringMethods inherited from class org.eclipse.epsilon.eol.AbstractModule
assignAnnotations, assignComment, assignComments, createAst, extractComments, getParseProblems, getSourceFile, getSourceUri, invokeMainRule, parse, parseMethods inherited from class org.eclipse.epsilon.common.module.AbstractModuleElement
equals, getChildren, getComments, getData, getDebugInfo, getFile, getModule, getParent, getRegion, getUri, hashCode, setModule, setParent, setRegion, setUriMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.epsilon.eol.IEolModule
configure, execute, getConfigurationProperties, getDeclaredModelDeclarations, getDeclaredOperations, getImportManager, getImports, getMain, getModelDeclarations, getOperations, getParentModule, getParseProblems, getPostOperationStatements, parse, setContext, setImportManager, setParentModuleMethods inherited from interface org.eclipse.epsilon.epl.IEplModule
getDeclaredPatterns, getMaximumLevel, getMaxLoops, getPatterns, isRepeatWhileMatches, matchPatterns, setMaxLoops, setRepeatWhileMatchesMethods inherited from interface org.eclipse.epsilon.erl.IErlModule
getContext, getDeclaredPost, getDeclaredPre, getPost, getPreMethods inherited from interface org.eclipse.epsilon.common.module.IModule
createAst, getSourceUri, parse, parse, parse, parse, parseMethods 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:
setSeedin interfaceIEmgModule- Parameters:
seed- the seed to set
-
setUseSeed
public void setUseSeed(boolean useSeed) - Specified by:
setUseSeedin interfaceIEmgModule- Parameters:
useSeed- the useSeed to set
-
getNamedCreatedObjects
- Specified by:
getNamedCreatedObjectsin interfaceIEmgModule- Returns:
- the namedCreatedObjects
-
getImportConfiguration
- Overrides:
getImportConfigurationin classAbstractEplModule
-
prepareContext
- Overrides:
prepareContextin classEolModule- Throws:
EolRuntimeException
-
processRules
Description copied from class:ErlModuleMain rule processing logic. Non-abstract for compatibility.- Overrides:
processRulesin 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:AbstractEplModuleThis 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:
matchin interfaceIEplModule- Overrides:
matchin 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
-