pub struct Rule {
id: u32,
source: Location,
target: Location,
guard: BooleanVarConstraint,
actions: Vec<Action>,
}Expand description
Rule type for a GeneralThresholdAutomaton
This type represents the rules appearing in a GeneralThresholdAutomaton.
Fields§
§id: u32Id assigned to the rule in the specification
source: LocationSource location of the rule
target: LocationTarget location of the rule
guard: BooleanVarConstraintGuards of the rule
actions: Vec<Action>Effect of the rule
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn transform_guard<F: FnMut(&mut BooleanVarConstraint)>(&mut self, t: F)
pub fn transform_guard<F: FnMut(&mut BooleanVarConstraint)>(&mut self, t: F)
Apply a transformation to the guard of the rule
A transformation in this case is a function that mutates a
BooleanVarConstraint.
Sourcepub fn retain_actions<F: Fn(&Action) -> bool>(&mut self, f: F)
pub fn retain_actions<F: Fn(&Action) -> bool>(&mut self, f: F)
Retains only the actions specified by the predicate.
In other words, it will remove all elements e for which f(&e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.
Sourcepub fn update_target(&mut self, loc: Location)
pub fn update_target(&mut self, loc: Location)
Updates the target location
Needed for the Preprocessor CollapseLocations
Trait Implementations§
impl Eq for Rule
Source§impl Ord for Rule
impl Ord for Rule
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Rule
impl PartialOrd for Rule
Source§impl RuleDefinition for Rule
impl RuleDefinition for Rule
Source§type Guard = BooleanExpression<Variable>
type Guard = BooleanExpression<Variable>
Source§fn guard(&self) -> &BooleanVarConstraint
fn guard(&self) -> &BooleanVarConstraint
Source§fn actions(&self) -> impl Iterator<Item = &Self::Action>
fn actions(&self) -> impl Iterator<Item = &Self::Action>
Source§fn has_decrements(&self) -> bool
fn has_decrements(&self) -> bool
Source§fn has_resets(&self) -> bool
fn has_resets(&self) -> bool
Source§impl TryFrom<&Rule> for LIARule
impl TryFrom<&Rule> for LIARule
Source§fn try_from(rule: &Rule) -> Result<Self, Self::Error>
fn try_from(rule: &Rule) -> Result<Self, Self::Error>
Try to convert a rule into a LIARule.
A rule can be converted into a LIARule if the guard is a linear
arithmetic formula. This means for example that it does not contain any
multiplications between variables
This function will return an LIATransformationError if the guard is
no linear arithmetic formula.