Skip to content

Commit

Permalink
rename for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-folsom committed Jan 14, 2024
1 parent 1f8669b commit b698a0b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
12 changes: 8 additions & 4 deletions crates/fj-core/src/validate/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ impl<T: Eq + PartialEq + Hash, U> ReferenceCounter<T, U> {
Self(HashMap::new())
}

pub fn add_count(&mut self, object: Handle<T>, found: Handle<U>) {
pub fn add_reference(
&mut self,
referenced: Handle<T>,
reference: Handle<U>,
) {
self.0
.entry(object)
.and_modify(|references| references.push(found.clone()))
.or_insert(vec![found]);
.entry(referenced)
.and_modify(|references| references.push(reference.clone()))
.or_insert(vec![reference]);
}

pub fn get_multiples(&self) -> Vec<MultipleReferences<T, U>> {
Expand Down
4 changes: 2 additions & 2 deletions crates/fj-core/src/validate/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ impl SketchValidationError {

sketch.regions().iter().for_each(|r| {
r.all_cycles().for_each(|c| {
referenced_cycles.add_count(c.clone(), r.clone());
referenced_cycles.add_reference(c.clone(), r.clone());
c.half_edges().into_iter().for_each(|e| {
referenced_edges.add_count(e.clone(), c.clone());
referenced_edges.add_reference(e.clone(), c.clone());
})
})
});
Expand Down
9 changes: 5 additions & 4 deletions crates/fj-core/src/validate/solid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,13 @@ impl SolidValidationError {

solid.shells().iter().for_each(|s| {
s.faces().into_iter().for_each(|f| {
referenced_faces.add_count(f.clone(), s.clone());
referenced_regions.add_count(f.region().clone(), f.clone());
referenced_faces.add_reference(f.clone(), s.clone());
referenced_regions.add_reference(f.region().clone(), f.clone());
f.region().all_cycles().for_each(|c| {
referenced_cycles.add_count(c.clone(), f.region().clone());
referenced_cycles
.add_reference(c.clone(), f.region().clone());
c.half_edges().into_iter().for_each(|e| {
referenced_edges.add_count(e.clone(), c.clone());
referenced_edges.add_reference(e.clone(), c.clone());
})
})
})
Expand Down

0 comments on commit b698a0b

Please sign in to comment.