forked from Ecdar/Reveaal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bugs for remove_clock_from_federation refactored declarations in component.rs to declarations.rs added set_dim() for TransitionSystem fixed a lot of bugs regarding the remove_clocks removed stale remove_clock methods from component.rs
- Loading branch information
Showing
32 changed files
with
286 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use edbm::util::constraints::ClockIndex; | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
|
||
/// The declaration struct is used to hold the indices for each clock, and is meant to be the owner of int variables once implemented | ||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Serialize)] | ||
pub struct Declarations { | ||
pub ints: HashMap<String, i32>, | ||
pub clocks: HashMap<String, ClockIndex>, | ||
} | ||
|
||
pub trait DeclarationProvider { | ||
fn get_declarations(&self) -> &Declarations; | ||
} | ||
|
||
impl Declarations { | ||
pub fn empty() -> Declarations { | ||
Declarations { | ||
ints: HashMap::new(), | ||
clocks: HashMap::new(), | ||
} | ||
} | ||
|
||
pub fn get_clock_count(&self) -> usize { | ||
self.clocks.len() | ||
} | ||
|
||
pub fn set_clock_indices(&mut self, start_index: ClockIndex) { | ||
for (_, v) in self.clocks.iter_mut() { | ||
*v += start_index | ||
} | ||
} | ||
|
||
pub fn get_clock_index_by_name(&self, name: &str) -> Option<&ClockIndex> { | ||
self.clocks.get(name) | ||
} | ||
|
||
/// Gets the name of a given `ClockIndex`. | ||
/// Returns `None` if it does not exist in the declarations | ||
pub fn get_clock_name_by_index(&self, index: ClockIndex) -> Option<&String> { | ||
self.clocks | ||
.iter() | ||
.find(|(_, v)| **v == index) | ||
.map(|(k, _)| k) | ||
} | ||
pub fn remove_clocks(&mut self, clocks_to_be_removed: &Vec<ClockIndex>) { | ||
Check failure on line 46 in src/model_objects/declarations.rs GitHub Actions / Clippy lint and checkwriting `&Vec` instead of `&[_]` involves a new object where a slice will do
|
||
let mut clock_count = *self.clocks.values().next().unwrap_or(&(1usize)); | ||
let mut new_clocks: HashMap<String, ClockIndex> = HashMap::new(); | ||
|
||
for (name, _) in self | ||
.clocks | ||
.iter() | ||
.filter(|(_, c)| !clocks_to_be_removed.contains(c)) | ||
{ | ||
new_clocks.insert(name.clone(), clock_count); | ||
clock_count += 1; | ||
} | ||
|
||
self.clocks = new_clocks; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod component; | ||
mod decision; | ||
pub mod declarations; | ||
mod edge; | ||
pub mod expressions; | ||
mod location; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.