2019-06-27 12:02:31 +00:00
|
|
|
#include "NumericalTableEvalValue.hpp"
|
|
|
|
#include "../Iterator/NumericalKeyIterator.hpp"
|
2019-09-12 16:19:06 +00:00
|
|
|
#include "../../Utilities/Random.hpp"
|
2019-06-27 12:02:31 +00:00
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline Porygon::Evaluation::Iterator *Porygon::Evaluation::NumericalTableEvalValue::GetKeyIterator() const {
|
2019-06-27 12:02:31 +00:00
|
|
|
return new NumericalKeyIterator(this);
|
|
|
|
}
|
2019-07-27 15:59:42 +00:00
|
|
|
|
|
|
|
Porygon::Evaluation::NumericalTableEvalValue::NumericalTableEvalValue(shared_ptr<vector<EvalValuePointer>> table) :
|
|
|
|
_table(std::move(table)),
|
2019-09-12 16:19:06 +00:00
|
|
|
_hash(Utilities::Random::Get())
|
2019-07-27 15:59:42 +00:00
|
|
|
{
|
|
|
|
}
|
2019-09-12 16:19:06 +00:00
|
|
|
|
|
|
|
Porygon::Evaluation::EvalValue *
|
|
|
|
Porygon::Evaluation::NumericalTableEvalValue::UnaryOperation(Porygon::Binder::BoundUnaryOperation operation) const {
|
|
|
|
if (operation == Porygon::Binder::BoundUnaryOperation::Count){
|
|
|
|
return new NumericEvalValue(static_cast<int64_t>(this->_table->size()));
|
|
|
|
}
|
|
|
|
return EvalValue::UnaryOperation(operation);
|
|
|
|
}
|