// and all subsequent events that are added by the iterator
}
-History::Iterator& History::Iterator::operator++()
+void History::Iterator::increment()
{
if (not frontier.empty()) {
// "Pop" the event at the "front"
- UnfoldingEvent* e = *frontier.begin();
+ const UnfoldingEvent* e = *frontier.begin();
frontier.remove(e);
// If there is a configuration and if the
// be searched since the configuration contains
// them (configuration invariant)
if (configuration.has_value() && configuration->get().contains(e)) {
- return *this;
+ return;
}
// Mark this event as seen
maximal_events.subtract(candidates);
candidates.subtract(current_history);
- frontier.form_union(std::move(candidates));
+ frontier.form_union(candidates);
}
- return *this;
+}
+
+const UnfoldingEvent* const& History::Iterator::dereference() const
+{
+ return *frontier.begin();
+}
+
+bool History::Iterator::equal(const Iterator& other) const
+{
+ // If what the iterator sees next is the same, we consider them
+ // to be the same iterator. This way, once the iterator has completed
+ // its search, it will be "equal" to an iterator searching nothing
+ return this->frontier == other.frontier;
}
EventSet History::get_all_events() const
return first.maximal_events;
}
-bool History::contains(UnfoldingEvent* e) const
+bool History::contains(const UnfoldingEvent* e) const
{
- return std::any_of(this->begin(), this->end(), [=](UnfoldingEvent* e_hist) { return e == e_hist; });
+ return std::any_of(this->begin(), this->end(), [=](const UnfoldingEvent* e_hist) { return e == e_hist; });
}
EventSet History::get_event_diff_with(const Configuration& config) const
{
auto wrapped_config = std::optional<std::reference_wrapper<const Configuration>>{config};
- auto first = Iterator(events_, std::move(wrapped_config));
+ auto first = Iterator(events_, wrapped_config);
const auto last = this->end();
for (; first != last; ++first)