From ab3a22edaa1cb7f3bc19d72503d7bca0bb6b2049 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 22 Sep 2025 21:20:08 +0200 Subject: [PATCH] Remove JournalingConstraintSystem. (#3305) The file was not referenced anywhere. --- .../src/journaling_constraint_system.rs | 117 ------------------ 1 file changed, 117 deletions(-) delete mode 100644 constraint-solver/src/journaling_constraint_system.rs diff --git a/constraint-solver/src/journaling_constraint_system.rs b/constraint-solver/src/journaling_constraint_system.rs deleted file mode 100644 index 0bd7e97b4..000000000 --- a/constraint-solver/src/journaling_constraint_system.rs +++ /dev/null @@ -1,117 +0,0 @@ -use crate::{ - constraint_system::{AlgebraicConstraint, BusInteraction, ConstraintSystem}, - grouped_expression::GroupedExpression, - indexed_constraint_system::IndexedConstraintSystem, - runtime_constant::{RuntimeConstant, Substitutable}, -}; -use std::{fmt::Display, hash::Hash}; - -/// A wrapper around `ConstraintSystem` that keeps track of changes. -pub struct JournalingConstraintSystem { - system: IndexedConstraintSystem, -} - -impl>> From - for JournalingConstraintSystem -{ - fn from(system: C) -> Self { - Self { - system: system.into(), - } - } -} - -impl JournalingConstraintSystem { - /// Returns the underlying `ConstraintSystem`. - pub fn system(&self) -> &ConstraintSystem { - self.system.system() - } - - pub fn indexed_system(&self) -> &IndexedConstraintSystem { - &self.system - } - - /// Returns an iterator over the algebraic constraints. - pub fn algebraic_constraints( - &self, - ) -> impl Iterator>> { - self.system.algebraic_constraints().iter() - } - - /// Returns an iterator over the bus interactions. - pub fn bus_interactions( - &self, - ) -> impl Iterator>> { - self.system.bus_interactions().iter() - } - - pub fn expressions(&self) -> impl Iterator> { - self.system.expressions() - } -} - -impl, V: Ord + Clone + Eq + Hash + Display> - JournalingConstraintSystem -{ - /// Applies multiple substitutions to the constraint system in an efficient manner. - pub fn apply_substitutions( - &mut self, - substitutions: impl IntoIterator)>, - ) { - // We do not track substitutions yet, but we could. - for (variable, substitution) in substitutions { - self.substitute_by_unknown(&variable, &substitution); - } - } - - pub fn substitute_by_unknown(&mut self, variable: &V, substitution: &GroupedExpression) { - // We do not track substitutions yet, but we could. - self.system.substitute_by_unknown(variable, substitution); - } -} - -impl JournalingConstraintSystem { - /// Adds new algebraic constraints to the system. - pub fn add_algebraic_constraints( - &mut self, - constraints: impl IntoIterator>>, - ) { - self.system.add_algebraic_constraints(constraints); - } - - /// Adds new bus interactions to the system. - pub fn add_bus_interactions( - &mut self, - bus_interactions: impl IntoIterator>>, - ) { - self.system.add_bus_interactions(bus_interactions); - } -} - -impl JournalingConstraintSystem { - /// Removes all algebraic constraints that do not fulfill the predicate. - pub fn retain_algebraic_constraints( - &mut self, - f: impl FnMut(&AlgebraicConstraint>) -> bool, - ) { - // We do not track removal of constraints yet, but we could. - self.system.retain_algebraic_constraints(f); - } - - /// Removes all bus interactions that do not fulfill the predicate. - pub fn retain_bus_interactions( - &mut self, - f: impl FnMut(&BusInteraction>) -> bool, - ) { - // TODO track - self.system.retain_bus_interactions(f); - } -} - -impl Display - for JournalingConstraintSystem -{ - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.system) - } -}