The Shifting Form (State)
Allowing an object to alter its behavior when its internal state changes.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Transmutation // Streamweaving
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
# State: Toggle state flag in hold space
/TOGGLE_STATE/ {
x
/STATE_ON/ {
s/.*/STATE_OFF/
x
d
}
s/.*/STATE_ON/
x
d
}
# Behavior depends on state
/DO_ACTION/ {
x
/STATE_ON/ {
x
s/.*/Action performed because state is ON/
p
d
}
x
s/.*/Action ignored because state is OFF/
p
d
}
Runic Tags:
#sed
#behavioral
#state