2024-02-25 12:01:06 +00:00
|
|
|
import * as plugins from './classes.plugins.js';
|
2017-07-05 12:29:08 +00:00
|
|
|
|
2024-02-25 12:01:06 +00:00
|
|
|
import { ObjectMap } from './classes.objectmap.js';
|
2017-07-05 12:29:08 +00:00
|
|
|
|
|
|
|
export class LoopTracker<T> {
|
2020-05-04 00:09:20 +00:00
|
|
|
referenceObjectMap = new ObjectMap<any>();
|
2018-01-27 17:11:11 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|