Compartir a través de


Condition Class

Provides conditions that can control the exploration of a rule, such as whether the rule is enabled and which parameter values can be generated for the rule.

Namespace: Microsoft.Modeling
Assembly: Microsoft.Xrt.Runtime (in Microsoft.Xrt.Runtime.dll)

Usage

'Usage

Syntax

'Declaration
public static class Condition

Example

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.
}

Remarks

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.

Inheritance Hierarchy

System.Object
  Microsoft.Modeling.Condition

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Microsoft Windows 7, Microsoft Windows Vista, Microsoft Windows XP SP2 or later, Microsoft Windows Server 2008, Microsoft Windows Server 2003

Change History

See Also

Reference

Condition Members
Microsoft.Modeling Namespace
Combination Class

Other Resources

Actions
Rules
Steps
Parameter Expansion Points