PrevTopNext

Updating Element States

The basics:
  • Command execution depends on the element state.
  • Status messages transmit the full state information.
  • Requirements for processing state messages:
    • There must be a matching element.
    • All mismatches must be logged.
    • Replace the element's state with the message data.
DSL definitions:
[when]{type} state=
      $state: {type!ucfirst}State( $id: id )
[when]matching element=
      {type!ucfirst}( id == $id )
[then]Element state error {text}=
      Operator.getMainOperator().message( {text} + ": " + $state );
[then]update the element=
      modify( $element )\{ \}
[then]- setting(?: the)? {property} from the {entity} message=
      set{property!ucfirst}( ${entity}.get{property!ucfirst}() )

Knack #7: Derive class names from nouns: switch -> Switch.
Knack #8: Create sub-phrases for fact modifications.


PrevTopNext