lik/ts/classes.looptracker.ts

24 lines
501 B
TypeScript
Raw Normal View History

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> {
referenceObjectMap = new ObjectMap<any>();
constructor() {
2017-07-05 12:29:08 +00:00
// nothing here
}
/**
* checks and tracks an object
* @param objectArg
*/
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
}
}