OCLOperators stateMachineForceMode
No edit summary
No edit summary
Line 4: Line 4:


Calling object.StateMachineForceMode(theStateAttribute) gives you one free pass to set the StateAttribute string directly:
Calling object.StateMachineForceMode(theStateAttribute) gives you one free pass to set the StateAttribute string directly:
The stateMachineForceMode is only good for 1 write so this will fail on the 3 line:
self.stateMachineForceMode('State');
self.State:='State3';
self.State:='State3'
But this will work:<blockquote>self.stateMachineForceMode('State');</blockquote><blockquote>self.State:='State3';</blockquote><blockquote>self.stateMachineForceMode('State');</blockquote><blockquote>self.State:='State3'</blockquote>Note! The stateMachineForceMode has the name of the state '''attribute''' as the parameter, not the name of the '''state''' itself.


[[Statemachines forcing your hand even if you are admin|Explained in more detail here]]
[[Statemachines forcing your hand even if you are admin|Explained in more detail here]]
self.stateMachineForceMode(‘StateAttribute’);
[[Category:MDriven Designer]]
self.StateAttribute:=’StateOneThing′;
self.stateMachineForceMode(‘StateAttribute’);
self.StateAttribute:=’StateSomething′
[[Category:MDriven Designer]]

Revision as of 21:39, 15 March 2020

This page was created by Hans.karlsen@mdriven.net on 2018-04-01. Last edited by Stephanie@mdriven.net on 2025-02-24.

stateMachine Force Mode.

StateMachines follow their rules. But sometimes when you change your model or find some bug you may find yourself in a situation where the current state of objects is wrong - and there is no legal way to get to the correct state. For this purpose we added the StateMachineForceMode operator - it is only intended to be used in a debugger or the like.

Calling object.StateMachineForceMode(theStateAttribute) gives you one free pass to set the StateAttribute string directly:

The stateMachineForceMode is only good for 1 write so this will fail on the 3 line:

self.stateMachineForceMode('State'); 
self.State:='State3'; 
self.State:='State3' 

But this will work:

self.stateMachineForceMode('State');

self.State:='State3';

self.stateMachineForceMode('State');

self.State:='State3'

Note! The stateMachineForceMode has the name of the state attribute as the parameter, not the name of the state itself.

Explained in more detail here