RuleChecks
Static class in Oadm.Sdk.Events · Oadm.Sdk.dll
The rules of field checks shared by the server and the rule dialog (SDK 0.9.0).
public static class RuleChecksMethods
Section titled “Methods”Describe
Section titled “Describe”static string Describe(RuleCheck check, string fieldName, EventValueKind kind)The check in one short phrase: “Temperature > 40”, “Door is yes”, “State equals active”.
static bool Fits(RuleCheckOperator op, EventValueKind kind)Whether op can check a field of kind.
IsNumeric
Section titled “IsNumeric”static bool IsNumeric(RuleCheckOperator op, EventValueKind kind)Whether the check compares numbers (every number operator, and = / ≠ on a number field).
static bool IsYes(string? text)“true”, “1” and “yes” (any case) count as yes.
static string Label(RuleCheckOperator op, EventValueKind kind)The operator in the Operator select of the rule dialog and its list: a number operator as its symbol and words (“= equals”, “≠ does not equal”, “> greater than”, “≥ greater than or equal”, “< less than”, “≤ less than or equal”), every other one as RuleChecks.Text.
NeedsValue
Section titled “NeedsValue”static bool NeedsValue(RuleCheckOperator op)False for yes / no: they have no value.
OperatorsFor
Section titled “OperatorsFor”static IReadOnlyList<RuleCheckOperator> OperatorsFor(EventValueKind kind)The operators a field of kind offers, in the order of the dialog.
Problem
Section titled “Problem”static string? Problem(RuleCheck check, IReadOnlyList<EventField> fields)The problem of one check against the fields of its event, or null: the field must be one of the event’s checkable fields (EventField.Filter), the operator must fit its kind, the value must be there (a number for number checks) and at most RuleChecks.MaxValueLength characters long. An older equals filter (RuleCheck.IsLegacy) only needs a value the event declares, as before field checks. “Temperature: enter a number, e.g. 21.5.”
static string Text(RuleCheckOperator op, EventValueKind kind)The operator in the dialog: “equals”, “does not equal”, “contains”, “starts with”, “=”, “≠”, “>”, “≥”, “<”, “≤”, “is yes”, “is no”.
TooMany
Section titled “TooMany”static bool TooMany(IReadOnlyCollection<RuleCheck> checks)Whether the checks of a condition are too many: more than RuleChecks.MaxPerCondition, unless every one is an older equals filter (RuleCheck.IsLegacy: rules of older versions had no limit and keep working unchanged).
TryParseNumber
Section titled “TryParseNumber”static bool TryParseNumber(string? text, out double value)A finite number in invariant culture (“21.5”, “-3”, “1e3”).
ValueProblem
Section titled “ValueProblem”static string? ValueProblem(RuleCheckOperator op, EventValueKind kind, string? value)The problem of the value of a check, or null (also the rule of the value box of the dialog).
Fields
Section titled “Fields”MaxPerCondition
Section titled “MaxPerCondition”const int MaxPerCondition = 5Most checks per event condition.
MaxValueLength
Section titled “MaxValueLength”const int MaxValueLength = 200Longest value of a check.
NoSuchValueText
Section titled “NoSuchValueText”const string NoSuchValueText = "The event no longer has this value."A check on a value the event does not have (any more), or not one a check can compare.
TooManyText
Section titled “TooManyText”static readonly string TooManyTextMore than RuleChecks.MaxPerCondition checks on one condition.