Package org.eclipse.epsilon.epl
Class EplModule
- All Implemented Interfaces:
IModule
,ModuleElement
,IEolModule
,IEplModule
,IErlModule
- Direct Known Subclasses:
EmgModule
,EplModuleParallel
Generator-based sequential implementation of EPL.
-
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 CombinationGenerator<Object>
getCandidates
(Pattern pattern) The dimensions of the returned nested Iterables are as follows:
Outer: The number of roles in the pattern (i.e.protected CompositeCombinationGenerator<Object>
initGenerator
(Pattern pattern) Create a new CompositeCombinationGenerator, add the generator for each role and attach the validator.protected DynamicList<Object>
wrapAdvancedRoleInstances
(Role role, String roleName, Collection<?> currentInstances_, AbstractEplModule.LazyAdvancedRoleInstancesInitializer initializer) protected DynamicList<Object>
wrapBasicRoleInstances
(Role role, String roleName, AbstractEplModule.LazyBasicRoleInstancesInitializer initializer) Wraps the result ofAbstractEplModule.preprocessRoleInstances(Role, String)
into the specified collection.Methods inherited from class org.eclipse.epsilon.epl.AbstractEplModule
adapt, build, createLexer, createModel, createParser, createPatternMatch, executeDoBlock, filterElements, flatMapRoleBindings, getContext, getDeclaredPatterns, getImportConfiguration, getMainRule, getMatchResult, getMaxLoops, getPatterns, getRoleInstances, getVariables, isRepeatWhileMatches, isValidCombination, match, matchCombination, matchPatterns, matchPatterns, negativeGuard, postProcessMatches, preMatch, processRules, 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, prepareContext, 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
getMaximumLevel
Methods inherited from interface org.eclipse.epsilon.erl.IErlModule
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
getChildren, getComments, getData, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUri
-
Constructor Details
-
EplModule
public EplModule() -
EplModule
-
-
Method Details
-
wrapBasicRoleInstances
protected DynamicList<Object> wrapBasicRoleInstances(Role role, String roleName, AbstractEplModule.LazyBasicRoleInstancesInitializer initializer) throws EolRuntimeException Description copied from class:AbstractEplModule
Wraps the result ofAbstractEplModule.preprocessRoleInstances(Role, String)
into the specified collection.- Specified by:
wrapBasicRoleInstances
in classAbstractEplModule
initializer
- Method reference toAbstractEplModule.preprocessRoleInstances(Role, String)
.- Returns:
- The result of AbstractEplModule.LazyBasicRoleInstancesInitializer.get(Role, String); either directly or wrapped into a custom collection.
- Throws:
EolRuntimeException
-
wrapAdvancedRoleInstances
protected DynamicList<Object> wrapAdvancedRoleInstances(Role role, String roleName, Collection<?> currentInstances_, AbstractEplModule.LazyAdvancedRoleInstancesInitializer initializer) throws EolRuntimeException - Specified by:
wrapAdvancedRoleInstances
in classAbstractEplModule
currentInstances_
- The values returned fromAbstractEplModule.wrapBasicRoleInstances(Role, String, LazyBasicRoleInstancesInitializer)
.initializer
- Method reference toAbstractEplModule.getNegativeRoleInstances(Role, String, Collection)
orAbstractEplModule.getAllRoleInstances(Role, String, Collection)
.- Returns:
- The result of LazyAdvancedRoleInstancesInitializer#initialize(Role, String); either directly or wrapped into a custom collection.
- Throws:
EolRuntimeException
-
getCandidates
protected final Iterator<List<List<Object>>> getCandidates(Pattern pattern) throws EolRuntimeException Description copied from class:AbstractEplModule
The dimensions of the returned nested Iterables are as follows:
Outer: The number of roles in the pattern (i.e.pattern.getRoles().size()
)
Mid: The number of instances as returned byRoleExecutor#getRoleInstances(Role, String)
multiplied by the number of names for that role (i.e.getRoleInstances(role).size()*role.getNames().size()
).
Inner: The number of elements which satisfy the guard and domain of the role, holding the value of previous role bindings and variables constant. As such, the dimensions of this inner-most Iterable can vary throughout execution if the role has dependencies on values computed in prior roles.- Specified by:
getCandidates
in classAbstractEplModule
- Returns:
- All combinations of model element instances conforming to the constraints imposed by the pattern's roles. Note that in most cases this will not be a Collection, but a generator (lazy Iterator) wrapped into an Iterable for convenience.
- Throws:
EolRuntimeException
-
initGenerator
protected CompositeCombinationGenerator<Object> initGenerator(Pattern pattern) throws EolRuntimeException Create a new CompositeCombinationGenerator, add the generator for each role and attach the validator.- Parameters:
pattern
- the pattern being executed- Returns:
- the created generator
- Throws:
EolRuntimeException
-
createCombinationGenerator
protected CombinationGenerator<Object> createCombinationGenerator(Role role) throws EolRuntimeException - Throws:
EolRuntimeException
-