aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/eval/test/cell_type_space.cpp
blob: 16e6ed928168ea45ec969480fa772ba85dcdfa87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "cell_type_space.h"

namespace vespalib::eval::test {

void
CellTypeSpace::step_state() {
    for (size_t idx = _state.size(); idx-- > 0; ) {
        if ((++_state[idx]) < _types.size()) {
            return;
        } else {
            _state[idx] = 0;
        }
    }
    _done = true;
}

bool
CellTypeSpace::should_skip() {
    if (_done) {
        return false;
    }
    bool same = true;
    auto type = _state[0];
    for (auto t: _state) {
        if (t != type) {
            same = false;
        }
    }
    return same ? _drop_same : _drop_different;
}

CellTypeSpace::~CellTypeSpace() = default;

} // namespace