4 * State calculator for multiple objects that returns the average state
6 class AverageStateCalculator
extends WorstStateCalculator
8 public function add_event($row = false)
10 foreach ($this->sub_reports
as $idx => $rpt) {
11 $rpt->add_event($row);
15 public function calculate_object_state() { /* No thanks */ }
17 public function finalize()
19 foreach ($this->sub_reports
as $rpt) {
23 foreach ($this->sub_reports
as $rpt) {
24 foreach ($rpt->st_raw
as $type => $value) {
25 $this->st_raw
[$type] = (isset($this->st_raw
[$type])?
$this->st_raw
[$type]:0) +
$value;
28 $c = count($this->sub_reports
);
29 foreach ($this->st_raw
as $type => $val) {
30 $this->st_raw
[$type] = $val / $c;