Condition Class
Namespace: Microsoft.Modeling
Assembly: Microsoft.Xrt.Runtime (in Microsoft.Xrt.Runtime.dll)
The following example contains a rule for an AddJob action in a model program. The rule is enabled if the time parameter of the AddJob action is a multiple of 60.
[Rule] static void AddJob(string name, int time, Frequency frequency) { Condition.IsTrue(time % 60 == 0); // Add state modification code here. }
Spec Explorer evaluates conditions as part of exploration. A rule describes a transition between states for a given action. Spec Explorer does not generate a transition for a rule for the current state and a given parameter combination if it encounters in the execution path of the rule any condition that is not satisfied.
If the context in which this action is explored has caused a state variable or action parameter to have a concrete value, Spec Explorer uses the concrete value in a condition to determine whether a rule should be added as a step in the exploration. If a state variable or action parameter contains a symbolic value, Spec Explorer generates the step and adds a constraint to the symbolic value, based on the condition.
If statements that precede a condition in a rule update state, Spec Explorer evaluates the condition against the updated state. However, Spec Explorer only adds the transition and updated state for a rule if all conditions for the rule are met.
This class contains a number of members for controlling exploration, of which the IsTrue(Boolean) method is the most basic. However, the AssertIsTrue method can be used to mark as an error state the target state of a rule, and is provided to help to identify logic errors in a model.
Development Platforms
Microsoft Windows 7, Microsoft Windows Vista, Microsoft Windows XP SP2 or later, Microsoft Windows Server 2008, Microsoft Windows Server 2003