mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
getActiveStates: return a sorted, uniqued vector
This commit is contained in:
parent
79308e6791
commit
7ad21500c4
@ -605,8 +605,8 @@ struct StateSet {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
flat_set<State> getActiveStates() const {
|
vector<State> getActiveStates() const {
|
||||||
flat_set<State> result;
|
vector<State> result;
|
||||||
|
|
||||||
for (u32 dist = 0; dist <= edit_distance; dist++) {
|
for (u32 dist = 0; dist <= edit_distance; dist++) {
|
||||||
// get all shadow vertices (including original graph)
|
// get all shadow vertices (including original graph)
|
||||||
@ -614,7 +614,7 @@ struct StateSet {
|
|||||||
for (size_t id = cur_shadow_vertices.find_first();
|
for (size_t id = cur_shadow_vertices.find_first();
|
||||||
id != cur_shadow_vertices.npos;
|
id != cur_shadow_vertices.npos;
|
||||||
id = cur_shadow_vertices.find_next(id)) {
|
id = cur_shadow_vertices.find_next(id)) {
|
||||||
result.emplace(id, dist, shadows_som[dist][id],
|
result.emplace_back(id, dist, shadows_som[dist][id],
|
||||||
State::NODE_SHADOW);
|
State::NODE_SHADOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,11 +628,12 @@ struct StateSet {
|
|||||||
for (size_t id = cur_helper_vertices.find_first();
|
for (size_t id = cur_helper_vertices.find_first();
|
||||||
id != cur_helper_vertices.npos;
|
id != cur_helper_vertices.npos;
|
||||||
id = cur_helper_vertices.find_next(id)) {
|
id = cur_helper_vertices.find_next(id)) {
|
||||||
result.emplace(id, dist, helpers_som[dist][id],
|
result.emplace_back(id, dist, helpers_som[dist][id],
|
||||||
State::NODE_HELPER);
|
State::NODE_HELPER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort_and_unique(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,6 +744,11 @@ bool operator<(const StateSet::State &a, const StateSet::State &b) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==(const StateSet::State &a, const StateSet::State &b) {
|
||||||
|
return a.idx == b.idx && a.level == b.level && a.type == b.type &&
|
||||||
|
a.som == b.som;
|
||||||
|
}
|
||||||
|
|
||||||
struct fmstate {
|
struct fmstate {
|
||||||
const size_t num_states; // number of vertices in graph
|
const size_t num_states; // number of vertices in graph
|
||||||
StateSet states; // currently active states
|
StateSet states; // currently active states
|
||||||
|
Loading…
x
Reference in New Issue
Block a user