Class AssignRule<TSemanticElement, TProperty>
Denotes a rule that assigns the value of a child rule to a certain property
public abstract class AssignRule<TSemanticElement, TProperty> : QuoteRule
Type Parameters
TSemanticElementThe type of the context element
TPropertyThe type of the property value
- Inheritance
-
AssignRule<TSemanticElement, TProperty>
- Derived
- Inherited Members
Properties
Feature
Gets the name of the feature that is assigned
protected abstract string Feature { get; }
Property Value
Methods
CanSynthesize(object, ParseContext, SynthesisPlan)
Determines whether the current rule can synthesize rule applications for the given semantic element
public override sealed bool CanSynthesize(object semanticElement, ParseContext context, SynthesisPlan synthesisPlan)
Parameters
semanticElementobjectthe semantic element
contextParseContextthe context in which the rule is synthesized
synthesisPlanSynthesisPlanthe plan of the synthesis
Returns
- bool
true, if a rule application can be synthesized, otherwise false
CanSynthesize(TSemanticElement, TProperty)
Determines whether the current rule can synthesize rule applications for the given semantic element
protected virtual bool CanSynthesize(TSemanticElement semanticElement, TProperty propertyValue)
Parameters
semanticElementTSemanticElementthe semantic element
propertyValueTPropertythe assigned property value
Returns
- bool
true, if a rule application can be synthesized, otherwise false
CreateSynthesisRequirements()
Creates a collection of requirements for synthesis
public override IEnumerable<SynthesisRequirement> CreateSynthesisRequirements()
Returns
- IEnumerable<SynthesisRequirement>
A collection of synthesis requirements
GetValue(TSemanticElement, ParseContext)
Gets the value of the given property
protected abstract TProperty GetValue(TSemanticElement semanticElement, ParseContext context)
Parameters
semanticElementTSemanticElementthe context element
contextParseContextthe parsing context
Returns
- TProperty
the property value
OnActivate(RuleApplication, ParseContext, bool)
Gets called when a rule application is activated
protected override void OnActivate(RuleApplication application, ParseContext context, bool initial)
Parameters
applicationRuleApplicationthe rule application that is activated
contextParseContextthe context in which the rule application is activated
initialboolflag indicating whether the activation happened due to initial parse
OnDeactivate(RuleApplication, ParseContext)
Gets called when a rule application is deactivated
protected override void OnDeactivate(RuleApplication application, ParseContext context)
Parameters
applicationRuleApplicationthe rule application that is deactivated
contextParseContextthe context in which the rule application is deactivated
OnValueChange(RuleApplication, ParseContext, RuleApplication)
Gets called when the value of a rule application changes
protected override bool OnValueChange(RuleApplication application, ParseContext context, RuleApplication oldRuleApplication)
Parameters
applicationRuleApplicationthe rule application for which the value changed
contextParseContextthe context in which the value changed
oldRuleApplicationRuleApplicationthe old rule application
Returns
- bool
true, if the rule processed the value change, otherwise false (in which case the value change is propagated)
SetValue(TSemanticElement, TProperty, ParseContext)
Gets called when the value changes
protected abstract void SetValue(TSemanticElement semanticElement, TProperty propertyValue, ParseContext context)
Parameters
semanticElementTSemanticElementthe context element
propertyValueTPropertythe property value
contextParseContextthe parsing context
Synthesize(object, ParsePosition, ParseContext)
Synthesizes a rule application for the given semantic element
public override RuleApplication Synthesize(object semanticElement, ParsePosition position, ParseContext context)
Parameters
semanticElementobjectpositionParsePositionthe parse position at which the element should be synthesized
contextParseContextthe parse context
Returns
- RuleApplication
a rule application