Show / Hide Table of Contents

Class Analyzer

This is the core engine of OAT

Inheritance
System.Object
Analyzer
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Microsoft.CST.OAT
Assembly: OAT.dll
Syntax
public class Analyzer

Constructors

| Improve this Doc View Source

Analyzer(AnalyzerOptions)

The constructor for Analyzer takes no arguments.

Declaration
public Analyzer(AnalyzerOptions analyzerOptions = null)
Parameters
Type Name Description
AnalyzerOptions analyzerOptions

Properties

| Improve this Doc View Source

CustomObjectToValuesDelegates

The ObjectToValuesDelegates that will be used in order of attempt. Once successful the others won't be run.

Declaration
public List<Analyzer.ObjectToValuesDelegate> CustomObjectToValuesDelegates { get; set; }
Property Value
Type Description
System.Collections.Generic.List<Analyzer.ObjectToValuesDelegate>
| Improve this Doc View Source

CustomPropertyExtractionDelegates

The PropertyExtractionDelegates that will be used in order of attempt. Once successful the others won't be run.

Declaration
public List<Analyzer.PropertyExtractionDelegate> CustomPropertyExtractionDelegates { get; set; }
Property Value
Type Description
System.Collections.Generic.List<Analyzer.PropertyExtractionDelegate>
| Improve this Doc View Source

Options

The options for the Analyzer

Declaration
public AnalyzerOptions Options { get; }
Property Value
Type Description
AnalyzerOptions

Methods

| Improve this Doc View Source

Analyze(IEnumerable<Rule>, Object, Object)

Which rules apply to this object given up to two states?

Declaration
public IEnumerable<Rule> Analyze(IEnumerable<Rule> rules, object state1 = null, object state2 = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Rule> rules

The rules to apply

System.Object state1

The first state

System.Object state2

The second state

Returns
Type Description
System.Collections.Generic.IEnumerable<Rule>

A Stack of Rules which apply

| Improve this Doc View Source

AnalyzeClause(Clause, Object, Object)

Determine if a Clause is true or false

Declaration
public bool AnalyzeClause(Clause clause, object state1 = null, object state2 = null)
Parameters
Type Name Description
Clause clause

The Clause to Analyze

System.Object state1

The first object state

System.Object state2

The second object state

Returns
Type Description
System.Boolean

If the Clause is true

| Improve this Doc View Source

Applies(Rule, Object, Object)

Does the rule apply to the object?

Declaration
public bool Applies(Rule rule, object state1 = null, object state2 = null)
Parameters
Type Name Description
Rule rule

The Rule to apply

System.Object state1

The first state of the object

System.Object state2

The second state of the object

Returns
Type Description
System.Boolean

True if the rule applies

| Improve this Doc View Source

ClearDelegates()

Clear all the set delegates

Declaration
public void ClearDelegates()
| Improve this Doc View Source

EnumerateRuleIssues(Rule)

Verifies the provided rule and provides a list of issues with the rules.

Declaration
public IEnumerable<Violation> EnumerateRuleIssues(Rule rule)
Parameters
Type Name Description
Rule rule

A Rule.

Returns
Type Description
System.Collections.Generic.IEnumerable<Violation>

Enumerable of issues with the Rule.

| Improve this Doc View Source

EnumerateRuleIssues(IEnumerable<Rule>)

Verifies the provided rules and provides a list of issues with the rules.

Declaration
public IEnumerable<Violation> EnumerateRuleIssues(IEnumerable<Rule> rules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Rule> rules

Enumerable of Rules.

Returns
Type Description
System.Collections.Generic.IEnumerable<Violation>

Enumerable of issues with the rules.

| Improve this Doc View Source

GetCapture(Rule, Object, Object)

Checks if the Rule matches and obtains its Capture

Declaration
public (bool RuleMatches, RuleCapture Result) GetCapture(Rule rule, object state1 = null, object state2 = null)
Parameters
Type Name Description
Rule rule

The Rule to test

System.Object state1

object state1

System.Object state2

object state2

Returns
Type Description
System.ValueTuple<System.Boolean, RuleCapture>
| Improve this Doc View Source

GetCaptures(IEnumerable<Rule>, Object, Object)

Get the RuleCaptures for the List of rules as applied to the objects

Declaration
public IEnumerable<RuleCapture> GetCaptures(IEnumerable<Rule> rules, object state1 = null, object state2 = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Rule> rules

List of Rules to run

System.Object state1

First state of object

System.Object state2

Second state of object

Returns
Type Description
System.Collections.Generic.IEnumerable<RuleCapture>
| Improve this Doc View Source

GetClauseCapture(Clause, Object, Object, IEnumerable<ClauseCapture>)

Execute the operation for a provided clause.

Declaration
public OperationResult GetClauseCapture(Clause clause, object state1 = null, object state2 = null, IEnumerable<ClauseCapture> captures = null)
Parameters
Type Name Description
Clause clause

The Clause to test

System.Object state1

object state1

System.Object state2

object state2

System.Collections.Generic.IEnumerable<ClauseCapture> captures

Existing captures to be passed to the clause.

Returns
Type Description
OperationResult

The OperationResult of the operation.

| Improve this Doc View Source

GetOperation(Operation, String)

Get the current operation is set for the Operation and customOperation pair provided. For default operations, use null or string.Empty for customOperation.

Declaration
public OatOperation GetOperation(Operation operation, string customOperation = null)
Parameters
Type Name Description
Operation operation
System.String customOperation
Returns
Type Description
OatOperation

If the OatOperation delegate is set for the given pair, will return the value, otherwise null.

| Improve this Doc View Source

GetTags(IEnumerable<Rule>, Object, Object)

Get the Tags which apply to the object given the Rules

Declaration
public string[] GetTags(IEnumerable<Rule> rules, object state1 = null, object state2 = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Rule> rules

The Rules to apply

System.Object state1

The first state of the object

System.Object state2

The second state of the object

Returns
Type Description
System.String[]
| Improve this Doc View Source

GetValueByPropertyString(Object, String)

Extracts a value stored at the specified path inside an object. Can crawl into Lists and Dictionaries of strings and return any top-level object.

Declaration
public object GetValueByPropertyString(object targetObject, string pathToProperty)
Parameters
Type Name Description
System.Object targetObject

The object to parse

System.String pathToProperty

The path of the property to fetch

Returns
Type Description
System.Object

The object found

| Improve this Doc View Source

IsRuleValid(Rule)

Determines if there are any problems with the provided rule.

Declaration
public bool IsRuleValid(Rule rule)
Parameters
Type Name Description
Rule rule

The rule to parse.

Returns
Type Description
System.Boolean

True if there are no issues.

| Improve this Doc View Source

ObjectToValues(Object)

Extracts string Values from an Object. Will call the custom ObjectToValues delegate.

Declaration
public (List<string>, List<KeyValuePair<string, string>>) ObjectToValues(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.ValueTuple<System.Collections.Generic.List<System.String>, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>>>

A tuple of A list of Strings extracted and a List of KVP extracted.

| Improve this Doc View Source

SetOperation(OatOperation)

Set the OatOperation which will be triggered by the provided Operation (and when Custom, CustomOperation)

Declaration
public bool SetOperation(OatOperation oatOperation)
Parameters
Type Name Description
OatOperation oatOperation

The OatOperation

Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryShortcut(Boolean, BoolOperator)

Check if a boolean operation can be shortcut and provide the shorcut if so.

Declaration
public static (bool CanShortcut, bool Value) TryShortcut(bool current, BoolOperator operation)
Parameters
Type Name Description
System.Boolean current

The current boolean state

BoolOperator operation

The Operation

Returns
Type Description
System.ValueTuple<System.Boolean, System.Boolean>

(If you can use a shortcut, the result of the shortcut)

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX