OCLOperators stateMachineForceMode
(Automatically adding template at the end of the page.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=== StateMachine Force Mode. ===
=== StateMachine Force Mode. ===
StateMachines follow their rules. However, when sometimes you change your model or find a 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 reason, we added the StateMachineForceMode operator which is only intended to be used in the debugger or the like.
StateMachines follow their rules. However, when you change your model or find a 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 reason, we added the StateMachineForceMode operator that is only intended to be used in the debugger or the like.


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:
The stateMachineForceMode is only good for 1 write so this will fail on the 3 lines:
  self.stateMachineForceMode('State');  
  self.stateMachineForceMode('State');  
  self.State:='State3';  
  self.State:='State3';  
  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.
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|This is explained in more detail here.]]
[[Statemachines forcing your hand even if you are admin|This is explained in more detail here.]]


[[State value as a string]]
See also: [[State value as a string]]
[[Category:MDriven Designer]]
[[Category:MDriven Designer]]
{{Edited|July|12|2024}}

Latest revision as of 15:43, 10 February 2024

StateMachine Force Mode.

StateMachines follow their rules. However, when you change your model or find a 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 reason, we added the StateMachineForceMode operator that is only intended to be used in the 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 lines:

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.

This is explained in more detail here.

See also: State value as a string

This page was edited 92 days ago on 02/10/2024. What links here