Skip to content

Commit

Permalink
add parameter comparison again
Browse files Browse the repository at this point in the history
  • Loading branch information
cvhammond committed Jan 30, 2024
1 parent 21e489c commit c6c2d9b
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/parameters.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Logic for parsing and writing parameters.
use crate::processor::Processor;
use crate::{C3dWriteError, C3dParseError};
use crate::{C3dParseError, C3dWriteError};
use grid::Grid;
use std::collections::HashMap;

Expand Down Expand Up @@ -216,30 +216,31 @@ impl Parameters {

impl PartialEq for Parameters {
fn eq(&self, other: &Self) -> bool {
//if self.parameters.len() != other.parameters.len() {
// return false;
//}
//for (group, (group_description, parameters)) in self.parameters.iter() {
// if !other.parameters.contains_key(group) {
// return false;
// }
// let other_group = other.parameters.get(group).unwrap();
// if group_description != &other_group.0 {
// return false;
// }
// if parameters.len() != other_group.1.len() {
// return false;
// }
// for (parameter_name, parameter) in parameters.iter() {
// if !other_group.1.contains_key(parameter_name) {
// return false;
// }
// let other_parameter = other_group.1.get(parameter_name).unwrap();
// if parameter != other_parameter {
// return false;
// }
// }
//}
if self.parameters.len() != other.parameters.len() {
return false;
}
for (group, (group_description, parameters)) in self.parameters.iter() {
if !other.parameters.contains_key(group) {
dbg!(group);
return false;
}
let other_group = other.parameters.get(group).unwrap();
if group_description != &other_group.0 {
return false;
}
if parameters.len() != other_group.1.len() {
return false;
}
for (parameter_name, parameter) in parameters.iter() {
if !other_group.1.contains_key(parameter_name) {
return false;
}
let other_parameter = other_group.1.get(parameter_name).unwrap();
if parameter != other_parameter {
return false;
}
}
}
true
}
}
Expand Down

0 comments on commit c6c2d9b

Please sign in to comment.