2014-11-19 15:52:01 -08:00
|
|
|
import {ProtoRecordRange, RecordRange} from './record_range';
|
2014-10-02 15:14:32 +02:00
|
|
|
import {ProtoRecord, Record} from './record';
|
2014-11-14 15:35:41 -08:00
|
|
|
import {FIELD, int, isPresent} from 'facade/lang';
|
2014-11-19 15:52:01 -08:00
|
|
|
|
2014-10-02 15:14:32 +02:00
|
|
|
export * from './record';
|
2014-11-19 15:52:01 -08:00
|
|
|
export * from './record_range'
|
2014-10-02 15:14:32 +02:00
|
|
|
|
|
|
|
export class ChangeDetector {
|
2014-11-21 21:19:23 -08:00
|
|
|
_rootRecordRange:RecordRange;
|
2014-11-19 15:52:01 -08:00
|
|
|
constructor(recordRange:RecordRange) {
|
|
|
|
this._rootRecordRange = recordRange;
|
2014-10-02 15:14:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
detectChanges():int {
|
|
|
|
var count:int = 0;
|
2014-11-19 15:52:01 -08:00
|
|
|
for (var record = this._rootRecordRange.findFirstEnabledRecord();
|
2014-11-14 15:35:41 -08:00
|
|
|
isPresent(record);
|
|
|
|
record = record.nextEnabled) {
|
2014-10-02 15:14:32 +02:00
|
|
|
if (record.check()) {
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|