29 if (minweight > maxweight)
30 throw std::invalid_argument (
"maxweight must not be smaller than minweight");
47 throw std::invalid_argument (
"maxweight must not be smaller than minweight");
59 throw std::invalid_argument (
"maxweight must not be smaller than minweight");
76 throw std::invalid_argument (
"rule must not be NULL");
78 this->
_rules.push_back (rule);
92 std::vector<Rule*>::iterator iter;
93 for (iter = this->
_rules.begin (); iter != this->
_rules.end (); iter++)
103 this->
_rules.erase (iter);
104 this->
_weight -= (*iter)->getWeight ();
111 std::vector<Rule*>::iterator iter;
112 for (iter = this->
_rules.begin (); iter != this->
_rules.end (); iter++)
113 if ((*iter)->getId () == id)
131 std::vector<Rule*>::iterator it;
132 size_t count, usedcount = 0, nonactive;
133 double totweight = 0, adjustment, compensation, _remainder, weight;
135 count = this->
_rules.size ();
139 for (it = this->
_rules.begin (); it != this->
_rules.end (); it++)
145 if (usedcount == 0 || usedcount == count)
148 nonactive = count - usedcount;
150 compensation = (
static_cast<double>(-(
static_cast<int>(usedcount)) *
151 adjustment)) / nonactive;
154 for (it = this->
_rules.begin (); it != this->
_rules.end (); it++)
159 ((rule->
getUsed ()) ? adjustment : compensation);
180 for (it = this->
_rules.begin (); it != this->
_rules.end (); it++)