aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/control_resources.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src/control_resources.rs')
-rw-r--r--crates/fparkan-runtime/src/control_resources.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/control_resources.rs b/crates/fparkan-runtime/src/control_resources.rs
index b9958229..e34a3dfc 100644
--- a/crates/fparkan-runtime/src/control_resources.rs
+++ b/crates/fparkan-runtime/src/control_resources.rs
@@ -34,6 +34,12 @@ impl Default for Resources {
}
impl Resources {
+ pub(super) fn alarm_active(&self, handle: ObjectHandle) -> bool {
+ self.clocks
+ .iter()
+ .any(|(owner, clock)| *owner == handle && clock.alarm.active)
+ }
+
pub(super) fn energy_available(&self, handle: ObjectHandle) -> bool {
!self.blocked_budgets.contains(&handle)
}