Package jetbrains.mps.generator.runtime
Class ReductionRuleBase
- java.lang.Object
 - 
- jetbrains.mps.generator.runtime.ReductionRuleBase
 
 
- 
- All Implemented Interfaces:
 TemplateReductionRule,TemplateRule,TemplateRuleForConcept
- Direct Known Subclasses:
 TemplateReductionPatternRuleInterpreted,TemplateReductionRuleInterpreted
public abstract class ReductionRuleBase extends Object implements TemplateReductionRule
Default implementation all generated reduction rules shall use. Facilitates extension of TemplateReductionRule interface without affecting existing code. IMPLEMENTATION NOTE: present approach keeps applicability information along with rule's consequence, although to me it looks reasonable to keep them separate, i.e. MC being responsible to register rules (pure execution) rather than MC being a mere collection of complex objects (both applicable and execution aspects). Applicable concept doesn't change throughout rule's life, and thus behavior/method doesn't seem to be the best approach. However, lack of base MC implementation forces be to go with existing pattern (unless I'd like to wait another release round to introduce base MC implementation which would register rules instead of just supplying them) 
- 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedReductionRuleBase(SNodeReference ruleNode, SAbstractConcept appConcept, boolean withInheritors) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanapplyToInheritors()SAbstractConceptgetApplicableConcept()SNodeReferencegetRuleNode()booleanisApplicable(TemplateContext context)Subclasses can rely on default implementation to returntrue.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface jetbrains.mps.generator.runtime.TemplateReductionRule
apply 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ReductionRuleBase
protected ReductionRuleBase(@NotNull SNodeReference ruleNode, @NotNull SAbstractConcept appConcept, boolean withInheritors)
- Parameters:
 ruleNode- identifies rule in template model, handy for navigation and error reportingappConcept- concept to trigger this reduction rulewithInheritors-trueto include sub-concepts of appConcept- Since:
 - 3.3
 
 
 - 
 
- 
Method Detail
- 
getRuleNode
@NotNull public SNodeReference getRuleNode()
- Specified by:
 getRuleNodein interfaceTemplateRule
 
- 
getApplicableConcept
@NotNull public final SAbstractConcept getApplicableConcept()
- Specified by:
 getApplicableConceptin interfaceTemplateRuleForConcept- Returns:
 - concept to trigger this rule
 
 
- 
applyToInheritors
public boolean applyToInheritors()
- Specified by:
 applyToInheritorsin interfaceTemplateRuleForConcept
 
- 
isApplicable
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException
Subclasses can rely on default implementation to returntrue.- Throws:
 GenerationException
 
 - 
 
 -