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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<?php
class FILTERData implements Iterator {
var $data;
var $filter;
var $filter_data;
function __construct(Iterator $unfiltered, DATAFilter $filter, $filter_data = NULL) {
$this->data = $unfiltered;
$this->filter = $filter;
if (is_array($filter_data)) $this->filter_data = $filter_data;
else $this->filter_data = array();
}
function rewind() {
$this->data->rewind();
$this->filter->Start($this->filter_data);
if ($this->data->valid()) {
$this->time = $this->data->key();
$this->values = $this->data->current();
if ($this->filter->ProcessVector($this->filter_data, $this->time, $this->values)) {
$this->next();
}
}
}
function next() {
do {
$this->data->next();
if ($this->data->valid()) {
$this->time = $this->data->key();
$this->values = $this->data->current();
} else {
break;
}
# echo $this->time . ", " . sizeof($this->values) . "\n";
} while ($this->filter->ProcessVector($this->filter_data, $this->time, $this->values));
}
function valid() {
return $this->data->valid();
}
function key() {
return $this->time;
}
function current() {
return $this->values;
}
}
?>
|