Class AssignReferenceRule<TSemanticElement, TReference>
Denotes a rule that assigns the resolved value of a child rule to a certain property
public abstract class AssignReferenceRule<TSemanticElement, TReference> : ResolveRule<TSemanticElement, TReference> where TReference : class
Type Parameters
TSemanticElement
The type of the context element
TReference
The type of the property value
- Inheritance
-
ResolveRule<TSemanticElement, TReference>AssignReferenceRule<TSemanticElement, TReference>
- Derived
- Inherited Members
Properties
ApplyOverReplace
Indicates whether a replace rather than apply is required on update
protected override bool ApplyOverReplace { get; }
Property Value
Feature
Gets the name of the feature that is assigned
protected abstract string Feature { get; }
Property Value
Methods
Apply(ParseContext, TSemanticElement, TReference)
Applies the given value to the provided context element
protected override void Apply(ParseContext context, TSemanticElement contextElement, TReference propertyValue)
Parameters
context
ParseContextthe parse context in which this operation is performed
contextElement
TSemanticElementthe element to which the value should be applied
propertyValue
TReferencethe value to apply
CanSynthesize(object, ParseContext, SynthesisPlan)
Determines whether the current rule can synthesize rule applications for the given semantic element
public override bool CanSynthesize(object semanticElement, ParseContext context, SynthesisPlan synthesisPlan)
Parameters
semanticElement
objectthe semantic element
context
ParseContextthe context in which the rule is synthesized
synthesisPlan
SynthesisPlanthe plan of the synthesis
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 TReference GetValue(TSemanticElement semanticElement, ParseContext context)
Parameters
semanticElement
TSemanticElementthe context element
context
ParseContextthe parsing context
Returns
- TReference
the property value
SetValue(TSemanticElement, TReference, ParseContext)
Gets called when the value changes
protected abstract void SetValue(TSemanticElement semanticElement, TReference propertyValue, ParseContext context)
Parameters
semanticElement
TSemanticElementthe context element
propertyValue
TReferencethe property value
context
ParseContextthe 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
semanticElement
objectposition
ParsePositionthe parse position at which the element should be synthesized
context
ParseContextthe parse context
Returns
- RuleApplication
a rule application
Unapply(ParseContext, TSemanticElement, TReference)
Unapplies the given value to the provided context element
protected override void Unapply(ParseContext context, TSemanticElement contextElement, TReference propertyValue)
Parameters
context
ParseContextthe parse context in which this operation is performed
contextElement
TSemanticElementthe element to which the value should be unapplied
propertyValue
TReferencethe value to unapply