Possibility
API / publicodes / Possibility
type Possibility = object; Defined in: packages/core/src/parsePossibilité.ts:14
Represents a single possibility value in a “une possibilité” mechanism. It can be a constant value (string or number), or a reference to an existing rule.
Properties
dottedName?
optional dottedName?: string; Defined in: packages/core/src/parsePossibilité.ts:49
The dotted name of the referenced rule, if the possibility is a reference.
nodeValue
nodeValue: string | number; Defined in: packages/core/src/parsePossibilité.ts:38
The value of the possibility, as it appears in the evaluated node.
notApplicable
notApplicable: ASTNode; Defined in: packages/core/src/parsePossibilité.ts:21
If the possibility is a reference, this contains a node that evaluates the applicability conditions of the referenced rule. Otherwise, it contains a constant node evaluating to false (as constant possibility are always applicable, for now)
publicodesValue
publicodesValue: string; Defined in: packages/core/src/parsePossibilité.ts:33
Representation of this possibility’s value in publicodes syntax, can be used in Engine.setSituation to set the value of the rule.
String are wrapped in single quotes, and numbers are represented as number followed by an optional unit
Example
"'value'"
"42 m/s" title?
optional title?: string; Defined in: packages/core/src/parsePossibilité.ts:54
The title of the referenced rule, if the possibility is a reference.
type
type: "number" | "string" | "reference"; Defined in: packages/core/src/parsePossibilité.ts:15
unit?
optional unit?: Unit; Defined in: packages/core/src/parsePossibilité.ts:44
The unit of the possibility value, if it is a number