Package org.eclipse.epsilon.epl
Class EplModule
- java.lang.Object
-
- All Implemented Interfaces:
IModule
,ModuleElement
,IEolModule
,IEplModule
,IErlModule
- Direct Known Subclasses:
EmgModule
,EplModuleParallel
public class EplModule extends AbstractEplModule
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
compilationContext, context, declaredModelDeclarations, declaredOperations, imports, main, modelDeclarations, operations, postOperationStatements
-
Fields inherited from class org.eclipse.epsilon.eol.AbstractModule
parseProblems, parser, sourceFile, sourceUri
-
-
Constructor Summary
Constructors Constructor Description EplModule()
EplModule(IEplContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CombinationGenerator<java.lang.Object>
createCombinationGenerator(Role role)
protected java.util.Iterator<java.util.List<java.util.List<java.lang.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<java.lang.Object>
initGenerator(Pattern pattern)
Create a new CompositeCombinationGenerator, add the generator for each role and attach the validator.protected DynamicList<java.lang.Object>
wrapAdvancedRoleInstances(Role role, java.lang.String roleName, java.util.Collection<?> currentInstances_, AbstractEplModule.LazyAdvancedRoleInstancesInitializer initializer)
protected DynamicList<java.lang.Object>
wrapBasicRoleInstances(Role role, java.lang.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, compile, execute, getCompilationContext, getDeclaredModelDeclarations, getDeclaredOperations, getImports, getImportsByExtension, getMain, getModelDelcarations, getOperations, getParentModule, getPostOperationStatements, prepareContext, setContext, 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, 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, getCompilationContext, getConfigurationProperties, getDeclaredModelDeclarations, getDeclaredOperations, getImports, getMain, getModelDelcarations, getOperations, getParentModule, getParseProblems, getPostOperationStatements, parse, setContext, 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
compile, createAst, getSourceUri, parse, parse, parse, parse, parse
-
Methods inherited from interface org.eclipse.epsilon.common.module.ModuleElement
getChildren, getComments, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUri
-
-
-
-
Constructor Detail
-
EplModule
public EplModule()
-
EplModule
public EplModule(IEplContext context)
-
-
Method Detail
-
wrapBasicRoleInstances
protected DynamicList<java.lang.Object> wrapBasicRoleInstances(Role role, java.lang.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<java.lang.Object> wrapAdvancedRoleInstances(Role role, java.lang.String roleName, java.util.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 java.util.Iterator<java.util.List<java.util.List<java.lang.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<java.lang.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<java.lang.Object> createCombinationGenerator(Role role) throws EolRuntimeException
- Throws:
EolRuntimeException
-
-