Skip to content

Commit 68ecd9e

Browse files
Make interface of equation_symbol_mappingt clearer
Make the fields private, document methods and put definition in cpp file.
1 parent 3e688e0 commit 68ecd9e

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

src/solvers/refinement/string_refinement_util.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,21 @@ exprt interval_sparse_arrayt::to_if_expression(const exprt &index) const
7373
return if_exprt(index_small_eq, then_expr, if_expr, if_expr.type());
7474
});
7575
}
76+
77+
void equation_symbol_mappingt::add(const std::size_t i, const exprt &expr)
78+
{
79+
equations_containing[expr].push_back(i);
80+
strings_in_equation[i].push_back(expr);
81+
}
82+
83+
std::vector<exprt>
84+
equation_symbol_mappingt::find_expressions(const std::size_t i)
85+
{
86+
return strings_in_equation[i];
87+
}
88+
89+
std::vector<std::size_t>
90+
equation_symbol_mappingt::find_equations(const exprt &expr)
91+
{
92+
return equations_containing[expr];
93+
}

src/solvers/refinement/string_refinement_util.h

+15-18
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,23 @@ class interval_sparse_arrayt final : public sparse_arrayt
6565
class equation_symbol_mappingt
6666
{
6767
public:
68-
// Record index of the equations that contain a given expression
68+
/// Record the fact that equation `i` contains expression `expr`
69+
void add(const std::size_t i, const exprt &expr);
70+
71+
/// \param i: index corresponding to an equation
72+
/// \return vector of expressions contained in the equation with the given
73+
/// index `i`
74+
std::vector<exprt> find_expressions(const std::size_t i);
75+
76+
/// \param expr: an expression
77+
/// \return vector of equations containing the given expression `expr`
78+
std::vector<std::size_t> find_equations(const exprt &expr);
79+
80+
private:
81+
/// Record index of the equations that contain a given expression
6982
std::map<exprt, std::vector<std::size_t>> equations_containing;
70-
// Record expressions that are contained in the equation with the given index
83+
/// Record expressions that are contained in the equation with the given index
7184
std::unordered_map<std::size_t, std::vector<exprt>> strings_in_equation;
72-
73-
void add(const std::size_t i, const exprt &expr)
74-
{
75-
equations_containing[expr].push_back(i);
76-
strings_in_equation[i].push_back(expr);
77-
}
78-
79-
std::vector<exprt> find_expressions(const std::size_t i)
80-
{
81-
return strings_in_equation[i];
82-
}
83-
84-
std::vector<std::size_t> find_equations(const exprt &expr)
85-
{
86-
return equations_containing[expr];
87-
}
8885
};
8986

9087
#endif // CPROVER_SOLVERS_REFINEMENT_STRING_REFINEMENT_UTIL_H

0 commit comments

Comments
 (0)