Interface Rule
-
- All Superinterfaces:
org.eclipse.emf.ecore.EObject,NamedElement,org.eclipse.emf.common.notify.Notifier
- All Known Implementing Classes:
RuleImpl
public interface Rule extends NamedElement
A representation of the model object 'Rule'.- See Also:
EmftvmPackage.getRule()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidapply(StackFrame frame)Applies this rule for the created traces.booleanapplyFirst(StackFrame frame)Applies and post-applies this rule for the first recorded match.java.lang.ObjectapplyFor(StackFrame frame, TraceLink trace)Applies this rule for the giventrace.java.lang.ObjectapplyOne(StackFrame frame, java.util.Map<java.lang.String,java.lang.Object> valuesMap)Applies this rule totracevoidclearFields()Clears the values of all registered fields within this rule.voidcompileIterables(ExecEnv env)Compiles the model element iterables for this rule.voidcompileState(ExecEnv env)Compiles the internal state of this rule for optimised matching.booleancompleteTraceFor(StackFrame frame, TraceLink trace)Completestracefor this rule by creating the output elements.voidcreateTraces(StackFrame frame)Creates trace elements for the recorded matches for this rule.voidcreateUniqueMapping(TraceLink trace)Creates a unique trace mapping entry for the source values intrace, if applicable.FieldfindField(java.lang.Object context, java.lang.String name)InputRuleElementfindInputElement(java.lang.String name)Finds theInputRuleElementwith the given name within the rule inheritance hierarchy depth-first.FieldfindStaticField(java.lang.Object context, java.lang.String name)LazySet<Rule>getAllESuperRules()Returns the transitive closure of super-rules, root rule first (LazySet's have a fixed iteration order).CodeBlockgetApplier()Returns the value of the 'Applier' containment reference.org.eclipse.emf.common.util.EList<Rule>getESubRules()Returns the value of the 'ESub Rules' reference list.org.eclipse.emf.common.util.EList<Rule>getESuperRules()Returns the value of the 'ESuper Rules' reference list.org.eclipse.emf.common.util.EList<Field>getFields()Returns the value of the 'Fields' containment reference list.org.eclipse.emf.common.util.EList<InputRuleElement>getInputElements()Returns the value of the 'Input Elements' containment reference list.CodeBlockgetMatcher()Returns the value of the 'Matcher' containment reference.RuleModegetMode()Returns the value of the 'Mode' attribute.ModulegetModule()Returns the value of the 'Module' container reference.org.eclipse.emf.common.util.EList<OutputRuleElement>getOutputElements()Returns the value of the 'Output Elements' containment reference list.CodeBlockgetPostApply()Returns the value of the 'Post Apply' containment reference.org.eclipse.emf.common.util.EList<java.lang.String>getSuperRules()Returns the value of the 'Super Rules' attribute list.TraceLinkgetUniqueTrace(StackFrame frame, java.lang.Object[] values)Returns the unique rule application trace forvalues, if applicable.booleanhasField(java.lang.String name)Returnstrueiff this rule has any registered fields with the givenname.booleanhasStaticField(java.lang.String name)Returnstrueiff this rule has any registered static fields with the givenname.booleanisAbstract()Returns the value of the 'Abstract' attribute.booleanisDefault()Returns the value of the 'Default' attribute.booleanisDistinctElements()Returns the value of the 'Distinct Elements' attribute.booleanisLeaf()Returns the value of the 'Leaf' attribute.booleanisUnique()Returns the value of the 'Unique' attribute.booleanisWithLeaves()Returns the value of the 'With Leaves' attribute.java.lang.ObjectmatchManual(StackFrame frame, java.lang.Object[] values)Matches this rule manually, if applicable.booleanmatchOne(StackFrame frame, java.util.Map<java.lang.String,java.lang.Object> valuesMap)Matches rule forvaluesMap.booleanmatchOneOnly(StackFrame frame, java.util.Map<java.lang.String,java.lang.Object> valuesMap)Matches this rule only (without super-rules) forvaluesMap.boolean[]matchRecursive(StackFrame frame)Matches this rule for the automatic recursive stage, if applicable.booleanmatchSingle(StackFrame frame)Matches this rule for the automatic single stage, if applicable.voidpostApply(StackFrame frame)Runs post-applier for this rule for the created traces.java.lang.ObjectpostApplyFor(StackFrame frame, TraceLink trace)Post-applies this rule for the giventrace.voidregisterField(Field field)voidresetState()Resets the internal state of this rule.voidsetAbstract(boolean value)Sets the value of the 'Abstract' attribute.voidsetApplier(CodeBlock value)Sets the value of the 'Applier' containment reference.voidsetDefault(boolean value)Sets the value of the 'Default' attribute.voidsetDistinctElements(boolean value)Sets the value of the 'Distinct Elements' attribute.voidsetMatcher(CodeBlock value)Sets the value of the 'Matcher' containment reference.voidsetMode(RuleMode value)Sets the value of the 'Mode' attribute.voidsetModule(Module value)Sets the value of the 'Module' container reference.voidsetPostApply(CodeBlock value)Sets the value of the 'Post Apply' containment reference.voidsetUnique(boolean value)Sets the value of the 'Unique' attribute.-
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset
-
Methods inherited from interface org.eclipse.m2m.atl.emftvm.NamedElement
getName, setName
-
-
-
-
Method Detail
-
getModule
Module getModule()
Returns the value of the 'Module' container reference. It is bidirectional and its opposite is 'Rules'.If the meaning of the 'Module' container reference isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Module' container reference.
- See Also:
setModule(Module),EmftvmPackage.getRule_Module(),Module.getRules()
-
setModule
void setModule(Module value)
Sets the value of the 'Module' container reference.- Parameters:
value- the new value of the 'Module' container reference.- See Also:
getModule()
-
getMode
RuleMode getMode()
Returns the value of the 'Mode' attribute. The literals are from the enumerationRuleMode.If the meaning of the 'Mode' attribute isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Mode' attribute.
- See Also:
RuleMode,setMode(RuleMode),EmftvmPackage.getRule_Mode()
-
getInputElements
org.eclipse.emf.common.util.EList<InputRuleElement> getInputElements()
Returns the value of the 'Input Elements' containment reference list. The list contents are of typeInputRuleElement. It is bidirectional and its opposite is 'Input For'.If the meaning of the 'Input Elements' containment reference list isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Input Elements' containment reference list.
- See Also:
EmftvmPackage.getRule_InputElements(),InputRuleElement.getInputFor()
-
getOutputElements
org.eclipse.emf.common.util.EList<OutputRuleElement> getOutputElements()
Returns the value of the 'Output Elements' containment reference list. The list contents are of typeOutputRuleElement. It is bidirectional and its opposite is 'Output For'.If the meaning of the 'Output Elements' containment reference list isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Output Elements' containment reference list.
- See Also:
EmftvmPackage.getRule_OutputElements(),OutputRuleElement.getOutputFor()
-
getESuperRules
org.eclipse.emf.common.util.EList<Rule> getESuperRules()
Returns the value of the 'ESuper Rules' reference list. The list contents are of typeRule. It is bidirectional and its opposite is 'ESub Rules'.If the meaning of the 'ESuper Rules' reference list isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'ESuper Rules' reference list.
- See Also:
EmftvmPackage.getRule_ESuperRules(),getESubRules()
-
getESubRules
org.eclipse.emf.common.util.EList<Rule> getESubRules()
Returns the value of the 'ESub Rules' reference list. The list contents are of typeRule. It is bidirectional and its opposite is 'ESuper Rules'.If the meaning of the 'ESub Rules' reference list isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'ESub Rules' reference list.
- See Also:
EmftvmPackage.getRule_ESubRules(),getESuperRules()
-
getMatcher
CodeBlock getMatcher()
Returns the value of the 'Matcher' containment reference. It is bidirectional and its opposite is 'Matcher For'.If the meaning of the 'Matcher' containment reference isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Matcher' containment reference.
- See Also:
setMatcher(CodeBlock),EmftvmPackage.getRule_Matcher(),CodeBlock.getMatcherFor()
-
setMatcher
void setMatcher(CodeBlock value)
Sets the value of the 'Matcher' containment reference.- Parameters:
value- the new value of the 'Matcher' containment reference.- See Also:
getMatcher()
-
getApplier
CodeBlock getApplier()
Returns the value of the 'Applier' containment reference. It is bidirectional and its opposite is 'Applier For'.If the meaning of the 'Applier' containment reference isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Applier' containment reference.
- See Also:
setApplier(CodeBlock),EmftvmPackage.getRule_Applier(),CodeBlock.getApplierFor()
-
setApplier
void setApplier(CodeBlock value)
Sets the value of the 'Applier' containment reference.- Parameters:
value- the new value of the 'Applier' containment reference.- See Also:
getApplier()
-
getPostApply
CodeBlock getPostApply()
Returns the value of the 'Post Apply' containment reference. It is bidirectional and its opposite is 'Post Apply For'.If the meaning of the 'Post Apply' containment reference isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Post Apply' containment reference.
- See Also:
setPostApply(CodeBlock),EmftvmPackage.getRule_PostApply(),CodeBlock.getPostApplyFor()
-
setPostApply
void setPostApply(CodeBlock value)
Sets the value of the 'Post Apply' containment reference.- Parameters:
value- the new value of the 'Post Apply' containment reference.- See Also:
getPostApply()
-
getSuperRules
org.eclipse.emf.common.util.EList<java.lang.String> getSuperRules()
Returns the value of the 'Super Rules' attribute list. The list contents are of typeString.If the meaning of the 'Super Rules' reference list isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Super Rules' attribute list.
- See Also:
EmftvmPackage.getRule_SuperRules()
-
isAbstract
boolean isAbstract()
Returns the value of the 'Abstract' attribute.If the meaning of the 'Abstract' attribute isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Abstract' attribute.
- See Also:
setAbstract(boolean),EmftvmPackage.getRule_Abstract()
-
setAbstract
void setAbstract(boolean value)
Sets the value of the 'Abstract' attribute.- Parameters:
value- the new value of the 'Abstract' attribute.- See Also:
isAbstract()
-
getFields
org.eclipse.emf.common.util.EList<Field> getFields()
Returns the value of the 'Fields' containment reference list. The list contents are of typeField. It is bidirectional and its opposite is 'Rule'.If the meaning of the 'Fields' containment reference list isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Fields' containment reference list.
- See Also:
EmftvmPackage.getRule_Fields(),Field.getRule()
-
isDefault
boolean isDefault()
Returns the value of the 'Default' attribute.If the meaning of the 'Default' attribute isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Default' attribute.
- See Also:
setDefault(boolean),EmftvmPackage.getRule_Default()
-
setDefault
void setDefault(boolean value)
Sets the value of the 'Default' attribute.- Parameters:
value- the new value of the 'Default' attribute.- See Also:
isDefault()
-
isDistinctElements
boolean isDistinctElements()
Returns the value of the 'Distinct Elements' attribute.If the meaning of the 'Distinct Elements' attribute isn't clear, there really should be more of a description here...
- Returns:
- the value of the 'Distinct Elements' attribute.
- See Also:
setDistinctElements(boolean),EmftvmPackage.getRule_DistinctElements()
-
setDistinctElements
void setDistinctElements(boolean value)
Sets the value of the 'Distinct Elements' attribute.- Parameters:
value- the new value of the 'Distinct Elements' attribute.- See Also:
isDistinctElements()
-
isUnique
boolean isUnique()
Returns the value of the 'Unique' attribute.A unique rule matches at most once against a unique (list of) source value(s). Traces created by a unique rule can also be efficiently lookup up, because each (list of) source value(s) maps to at most one (list of) target value(s).
- Returns:
- the value of the 'Unique' attribute.
- See Also:
setUnique(boolean),EmftvmPackage.getRule_Unique()
-
setUnique
void setUnique(boolean value)
Sets the value of the 'Unique' attribute.- Parameters:
value- the new value of the 'Unique' attribute.- See Also:
isUnique()
-
isLeaf
boolean isLeaf()
Returns the value of the 'Leaf' attribute.A rule is a leaf rule when it is not abstract, and it has no leaf sub-rules. Call
#compileState()before calling this method.- Returns:
- the value of the 'Leaf' attribute.
- See Also:
EmftvmPackage.getRule_Leaf()
-
isWithLeaves
boolean isWithLeaves()
Returns the value of the 'With Leaves' attribute.A rule is with leaves if it has leaf sub-rules. Call
#compileState()before calling this method.- Returns:
- the value of the 'With Leaves' attribute.
- See Also:
EmftvmPackage.getRule_WithLeaves()
-
findField
Field findField(java.lang.Object context, java.lang.String name)
- Parameters:
context- the context type of the fieldname- the operation name- Returns:
- the
Fieldwith the given properties, ornullif none registered
-
hasField
boolean hasField(java.lang.String name)
Returnstrueiff this rule has any registered fields with the givenname.- Parameters:
name- the field name- Returns:
trueiff this rule has any registered fields with the givenname
-
findStaticField
Field findStaticField(java.lang.Object context, java.lang.String name)
- Parameters:
context- the context type of the fieldname- the operation name- Returns:
- the static
Fieldwith the given properties, ornullif none registered
-
hasStaticField
boolean hasStaticField(java.lang.String name)
Returnstrueiff this rule has any registered static fields with the givenname.- Parameters:
name- the field name- Returns:
trueiff this rule has any registered static fields with the givenname
-
matchSingle
boolean matchSingle(StackFrame frame)
Matches this rule for the automatic single stage, if applicable. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the matcher- Returns:
trueiff the rule has any matches
-
matchRecursive
boolean[] matchRecursive(StackFrame frame)
Matches this rule for the automatic recursive stage, if applicable. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the matcher- Returns:
- [
trueiff the rule has any matches,trueiff there was a guaranteed final match]
-
matchManual
java.lang.Object matchManual(StackFrame frame, java.lang.Object[] values)
Matches this rule manually, if applicable. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the matchervalues- the values to match against- Returns:
- the rule application result, or
nullif the rule did not match - Throws:
VMException- if this is not aRuleMode.MANUALrule
-
matchOne
boolean matchOne(StackFrame frame, java.util.Map<java.lang.String,java.lang.Object> valuesMap)
Matches rule forvaluesMap. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the matchervaluesMap- the values to match against- Returns:
trueiff the rule matches
-
matchOneOnly
boolean matchOneOnly(StackFrame frame, java.util.Map<java.lang.String,java.lang.Object> valuesMap)
Matches this rule only (without super-rules) forvaluesMap. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the matchervaluesMap- the values to match against- Returns:
trueiff the rule matches
-
createTraces
void createTraces(StackFrame frame)
Creates trace elements for the recorded matches for this rule. Call#compileState()before calling this method.- Parameters:
frame- the stack frame context- Throws:
VMException- if no matches are recorded for this rule
-
completeTraceFor
boolean completeTraceFor(StackFrame frame, TraceLink trace)
Completestracefor this rule by creating the output elements. Will create default/unique trace iff mapsTo information exists. Call#compileState()before calling this method.- Parameters:
frame- the stack frame contexttrace- the trace to complete- Returns:
trueiff default/unique mappings were defined for the complete list of source elements
-
apply
void apply(StackFrame frame)
Applies this rule for the created traces. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the applier- Throws:
VMException- if no traces exist for this rule
-
postApply
void postApply(StackFrame frame)
Runs post-applier for this rule for the created traces. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the post-applier- Throws:
VMException- if no traces exist for this rule
-
applyFirst
boolean applyFirst(StackFrame frame)
Applies and post-applies this rule for the first recorded match. Call#compileState()before calling this method.- Parameters:
frame- the stack frame in which to execute the applier and post-applier- Returns:
trueiff this rule was applied- Throws:
VMException- if no matches are recorded for this rule
-
applyOne
java.lang.Object applyOne(StackFrame frame, java.util.Map<java.lang.String,java.lang.Object> valuesMap)
Applies this rule totrace- Parameters:
frame- the stack frame in which to execute the applier and post-applyvaluesMap- the source and target values to which to apply the rule- Returns:
- the rule application result
-
applyFor
java.lang.Object applyFor(StackFrame frame, TraceLink trace)
Applies this rule for the giventrace. Call#compileState()before calling this method.- Parameters:
frame- the stack frame contexttrace- the trace link to apply the rule for- Returns:
- the application result
-
postApplyFor
java.lang.Object postApplyFor(StackFrame frame, TraceLink trace)
Post-applies this rule for the giventrace. Call#compileState()before calling this method.- Parameters:
frame- the stack frame contexttrace- the trace link to post-apply the rule for- Returns:
- the post-application result
-
getAllESuperRules
LazySet<Rule> getAllESuperRules()
Returns the transitive closure of super-rules, root rule first (LazySet's have a fixed iteration order). Call#compileState()before calling this method.- Returns:
- the transitive closure of super-rules.
-
createUniqueMapping
void createUniqueMapping(TraceLink trace)
Creates a unique trace mapping entry for the source values intrace, if applicable.- Parameters:
trace- the trace element with source values
-
compileState
void compileState(ExecEnv env)
Compiles the internal state of this rule for optimised matching. Call this method whenever any properties of this rule or any sub-rules have changed.- Parameters:
env- the execution environment context
-
resetState
void resetState()
Resets the internal state of this rule. Call this method before callingcompileState(ExecEnv)on all rules.
-
compileIterables
void compileIterables(ExecEnv env)
Compiles the model element iterables for this rule. Call this method whenever any input or in/out model has changed.- Parameters:
env- the execution environment context
-
clearFields
void clearFields()
Clears the values of all registered fields within this rule.
-
findInputElement
InputRuleElement findInputElement(java.lang.String name)
Finds theInputRuleElementwith the given name within the rule inheritance hierarchy depth-first.- Parameters:
name- the input element name- Returns:
- the
InputRuleElementwith the given name ornull
-
getUniqueTrace
TraceLink getUniqueTrace(StackFrame frame, java.lang.Object[] values)
Returns the unique rule application trace forvalues, if applicable.- Parameters:
frame- the stack frame contextvalues- the source values for the trace- Returns:
- the unique rule application trace, or
null
-
-