use core::time::Duration;
use crate::testing::specs::csp::{Action, State};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ClockVariable {
pub name: String,
pub initial_value: u64,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TimingGuard {
ClockLessThan(String, Duration),
ClockLessEqual(String, Duration),
ClockGreaterThan(String, Duration),
ClockGreaterEqual(String, Duration),
ClockEquals(String, Duration),
ClockInRange(String, Duration, Duration),
}
#[derive(Debug, Clone)]
pub struct TimedTransition {
pub from: State,
pub action: Action,
pub to: State,
pub guard: Option<TimingGuard>,
pub reset_clocks: Vec<String>,
}
impl TimedTransition {
pub fn new(from: State, action: Action, to: State) -> Self {
Self { from, action, to, guard: None, reset_clocks: Vec::new() }
}
pub fn with_guard(mut self, guard: TimingGuard) -> Self {
self.guard = Some(guard);
self
}
pub fn with_reset_clocks(mut self, clocks: Vec<String>) -> Self {
self.reset_clocks = clocks;
self
}
}