Class BranchArmOrderChecker
- Namespace
- DialogueDown.Playbook.Checking
- Assembly
- DialogueDown.Playbook.dll
Refuses a BranchNode whose arms are not in the order they are tried.
public sealed class BranchArmOrderChecker : IPlaybookChecker
- Inheritance
-
BranchArmOrderChecker
- Implements
- Inherited Members
Remarks
A branch's arms are tried in order, and each carries an explicit Order
because a reader is not obliged to preserve the array it was written in. The compiler emits the
arms in source order with the order equal to the arm's index, but the format does not say so, so
a hand-edited or tool-written playbook can list them out of order or put the else before a
gated arm. Two conformant readers — one that walks the array, one that sorts by order —
would then take different arms.
Three guards, independent and all required: at least one arm is gated (a branch is a block
condition, and an else needs one to fall back from), the arms ascend as they appear, and
the conditionless else, when present, is the last arm. The last guard refuses a second
conditionless arm, since at most one arm can be last. A fall-through (succession) is not
an arm, so its position is left to the outward-shape rule.
Methods
- Check(PlaybookDocument)
Checks a playbook, and says nothing when it passes.