2018-07-15 14:04:27 +00:00
|
|
|
import * as plugins from './lik.plugins';
|
2017-07-05 12:29:08 +00:00
|
|
|
|
2018-07-15 14:04:27 +00:00
|
|
|
import { Objectmap } from './lik.objectmap';
|
2017-07-05 12:29:08 +00:00
|
|
|
|
|
|
|
export class LoopTracker<T> {
|
2018-01-27 17:11:11 +00:00
|
|
|
referenceObjectMap = new Objectmap<any>();
|
|
|
|
constructor() {
|
2017-07-05 12:29:08 +00:00
|
|
|
// nothing here
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* checks and tracks an object
|
|
|
|
* @param objectArg
|
|
|
|
*/
|
2020-02-06 15:31:58 +00:00
|
|
|
checkAndTrack(objectArg: T): boolean {
|
|
|
|
if (!this.referenceObjectMap.checkForObject(objectArg)) {
|
|
|
|
this.referenceObjectMap.add(objectArg);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
2017-07-05 12:29:08 +00:00
|
|
|
}
|
|
|
|
}
|