2016-07-30 22:54:46 +00:00
|
|
|
"use strict";
|
|
|
|
/**
|
|
|
|
* allows keeping track of objects
|
|
|
|
*/
|
|
|
|
class Objectmap {
|
|
|
|
constructor() {
|
|
|
|
this.objectArray = [];
|
|
|
|
}
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
|
|
|
* add object to Objectmap
|
|
|
|
*/
|
2016-07-30 22:54:46 +00:00
|
|
|
add(objectArg) {
|
|
|
|
this.objectArray.push(objectArg);
|
|
|
|
}
|
|
|
|
;
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
|
|
|
* remove object from Objectmap
|
|
|
|
*/
|
2016-07-30 22:54:46 +00:00
|
|
|
remove(objectArg) {
|
|
|
|
let replacmentArray = [];
|
|
|
|
for (let item of this.objectArray) {
|
|
|
|
if (item !== objectArg) {
|
|
|
|
replacmentArray.push(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
;
|
|
|
|
this.objectArray = replacmentArray;
|
|
|
|
}
|
|
|
|
;
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
|
|
|
* check if object is in Objectmap
|
|
|
|
*/
|
2016-07-30 22:54:46 +00:00
|
|
|
checkForObject(objectArg) {
|
|
|
|
return this.objectArray.indexOf(objectArg !== -1);
|
|
|
|
}
|
|
|
|
;
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
|
|
|
* run function for each item in Objectmap
|
|
|
|
*/
|
|
|
|
forEach(functionArg) {
|
2016-07-31 13:01:24 +00:00
|
|
|
return this.objectArray.forEach(functionArg);
|
2016-07-31 12:36:28 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* wipe Objectmap
|
|
|
|
*/
|
2016-07-30 22:54:46 +00:00
|
|
|
wipe() {
|
|
|
|
this.objectArray = [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.Objectmap = Objectmap;
|
2016-07-31 13:01:24 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjo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