Assembly: Gallio (in Gallio.dll) Version: 3.2.0.0 (3.2.528.0)
Syntax
| C# |
|---|
public interface IPattern |
| Visual Basic (Declaration) |
|---|
Public Interface IPattern |
Remarks
The general idea is that a pattern applies contributions to a IPatternScope that represents the state of the pattern interpretation process. A primary pattern adds contributions to its containing scope with the Consume(IPatternScope, ICodeElementInfo, Boolean) method. All patterns (primary and non-primary) add further contributions to the pattern's own scope with the Process(IPatternScope, ICodeElementInfo) method.
A pattern can also defer some of its processing by registering a decorator on the scope. Once all of the decorators have been gathered, they can be applied in sorted order as required.
Pattern processing is performed recursively. First the primary pattern for the assembly is found. If none is registered then the default assembly pattern is used instead. The assembly pattern then performs reflection over the types within the assembly and hands off control (via Consume(IPatternScope, ICodeElementInfo, Boolean)) to any primary patterns it finds each type. Likewise the types scan their members and call into their primary patterns. And so on. Each primary pattern is responsible for invoking (via Process(IPatternScope, ICodeElementInfo)) any additional non-primary patterns associated with their code element after they have established the appropriate evaluation scope.
Typically a pattern is associated with a code element by means of a PatternAttribute but other associations are possible. Some patterns might define default rules for recursively processing code elements that do not have primary patterns of their own. Others might use means other than standard reflection to discover the patterns to be applied. The process is intended to be open and extensible.
