RuleAttribute Class
Namespace: Microsoft.Modeling
Assembly: Microsoft.Xrt.Runtime (in Microsoft.Xrt.Runtime.dll)
The following example shows an action declaration in Cord and a corresponding action invocation in a C# model program.
// An action declaration within a Cord config block. action static abstract int Implementation.Sum(int x);
static int stateTotal; // An action invocation within a model program. [Rule(Action = "Sum(op) / result")] static int AddtoTotal(int op) { return stateTotal += op; }
When Spec Explorer explores a machine defined in Cord script, Spec Explorer creates the transition system for the machine by iteratively examining available, unexplored states.
For a machine that includes or references a model program construct, Spec Explorer generates a transition from a state for a rule if all the rule's conditions are satisfied for the state. If a rule contains any conditions that are not satisfied for the state, the rule does not generate a transition from that state.
A rule can generate more than one transition from a state. For each transition that the rule generates, Spec Explorer labels the transition with the action invocation associated with the rule. States and action invocations can contain symbolic elements. A labeled transition is called a step.
To explicitly associate a rule with an action, set the Action named parameter when you apply the RuleAttribute attribute. If you do not provide an Action named parameter when you apply the Rule attribute, then Spec Explorer uses the name and parameter list of the member to which the Rule attribute is applied to identify the action associated with the rule. For a list of initial property values for an instance of the Rule attribute, see the RuleAttribute constructor. For more information about rules and actions, see Rules and Actions.
For more information about using attributes, see Extending Metadata Using Attributes.
Development Platforms
Microsoft Windows 7, Microsoft Windows Vista, Microsoft Windows XP SP2 or later, Microsoft Windows Server 2008, Microsoft Windows Server 2003