Element <state-machine>¶
Purpose: Declare a named weighted state graph consumed as a deterministic generator.
Why: Use it when generated values must follow a named, weighted transition graph.
Example¶
1 | |
Decision guide¶
Business value: Generates values that obey an explicit business lifecycle instead of independent sampling.
-
Use when
- A status or state must follow allowed, optionally weighted transitions.
-
Choose another approach when
- Values are independent categories without lifecycle constraints.
-
Prerequisites
- Declare a start state and a connected set of transition children.
-
Alternatives
- Use key values or weights for independent categorical sampling. (See:
<key>)
- Use key values or weights for independent categorical sampling. (See:
Complete examples¶
Generate a deterministic order lifecycle from a transition graph
Use a state machine when values must follow allowed business transitions instead of independent random selection.
| order-lifecycle/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 | |
Rules and invalid combinations¶
I923 — State Machine No Transitions
Why: A
Resolution: Add at least one
I924 — State Machine Duplicate Id
Duplicate
Why: Two or more
Resolution: Use a distinct id= for each
I925 — State Machine Id Collides With Generator
Why: A
Resolution: Choose an id= that does not match any registered generator class name.
Allowed parents / Allowed children¶
Allowed parents: else, else-if, if, setup, while
Allowed children:
transition
Attributes¶
Show all 2 attributes
id
Registration id for this state machine; referenced later via generator=
required; string.
start
Starting state name. Defaults to the first
optional; string; Default: null.