diff --git a/src/fractal.cpp b/src/fractal.cpp index 20c0731..cee25b6 100644 --- a/src/fractal.cpp +++ b/src/fractal.cpp @@ -19,6 +19,26 @@ token_id_t ruleset_t::add_token(token_type_e type, mtl::fixed value) { return m_tokens.size() - 1; } +group_id_t ruleset_t::add_group_characteristic(const etl::ivector& tokens, uint32_t factor) { + if (m_group_characteristics.full()) { + throw mtl::length_error(); + } + + m_group_characteristics.push_back(group_characteristic_t()); + group_characteristic_t& chr = m_group_characteristics.back(); + chr.m_factor = factor; + + for (token_id_t tok : tokens) { + if (!valid_token(tok)) { + throw mtl::invalid_argument(); + } + + chr.m_token_ids.push_back(tok); + } + + return m_group_characteristics.size() - 1; +} + #if 0 token_id_t generator_t::add_token(token_type_e type, mtl::fixed value) { log::debug << "Adding token with type " << (int)type << endl;