2016-08-08 15:29:44 +00:00
|
|
|
export interface IObjectmapForEachFunction<T> {
|
|
|
|
(itemArg: T): void;
|
2016-07-31 12:36:28 +00:00
|
|
|
}
|
2016-08-08 15:29:44 +00:00
|
|
|
export interface IObjectmapFindFunction<T> {
|
|
|
|
(itemArg: T): boolean;
|
2016-08-08 14:00:14 +00:00
|
|
|
}
|
2016-07-30 22:54:46 +00:00
|
|
|
/**
|
|
|
|
* allows keeping track of objects
|
|
|
|
*/
|
2016-08-08 15:29:44 +00:00
|
|
|
export declare class Objectmap<T> {
|
2016-07-30 22:54:46 +00:00
|
|
|
private objectArray;
|
2016-08-07 16:08:52 +00:00
|
|
|
/**
|
|
|
|
* returns a new instance
|
|
|
|
*/
|
|
|
|
constructor();
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
|
|
|
* add object to Objectmap
|
|
|
|
*/
|
2016-08-08 15:29:44 +00:00
|
|
|
add(objectArg: T): void;
|
2016-09-22 10:00:33 +00:00
|
|
|
/**
|
|
|
|
* like .add but adds an whole array of objects
|
|
|
|
*/
|
|
|
|
addArray(objectArrayArg: T[]): void;
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
|
|
|
* check if object is in Objectmap
|
|
|
|
*/
|
2016-08-08 15:29:44 +00:00
|
|
|
checkForObject(objectArg: T): boolean;
|
2016-08-08 14:00:14 +00:00
|
|
|
/**
|
|
|
|
* find object
|
|
|
|
*/
|
2016-08-08 15:29:44 +00:00
|
|
|
find(findFunction: IObjectmapFindFunction<T>): T;
|
2016-11-19 22:54:52 +00:00
|
|
|
/**
|
|
|
|
* finds a specific element and then removes it
|
|
|
|
*/
|
|
|
|
findOneAndRemove(findFunction: any): T;
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
|
|
|
* run function for each item in Objectmap
|
|
|
|
*/
|
2016-08-08 15:29:44 +00:00
|
|
|
forEach(functionArg: IObjectmapForEachFunction<T>): void;
|
2016-07-31 12:36:28 +00:00
|
|
|
/**
|
2016-11-19 22:08:54 +00:00
|
|
|
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
2016-07-31 12:36:28 +00:00
|
|
|
*/
|
2016-11-19 22:08:54 +00:00
|
|
|
getOneAndRemove(): T;
|
2016-09-29 20:05:20 +00:00
|
|
|
/**
|
|
|
|
* returns a cloned array of all the objects currently in the Objectmap
|
|
|
|
*/
|
|
|
|
getArray(): T[];
|
2016-11-19 22:54:52 +00:00
|
|
|
/**
|
|
|
|
* check if Objectmap ist empty
|
|
|
|
*/
|
|
|
|
isEmpty(): boolean;
|
2016-11-19 22:08:54 +00:00
|
|
|
/**
|
|
|
|
* remove object from Objectmap
|
|
|
|
*/
|
|
|
|
remove(objectArg: T): void;
|
|
|
|
/**
|
|
|
|
* wipe Objectmap
|
|
|
|
*/
|
|
|
|
wipe(): void;
|
2016-07-30 22:54:46 +00:00
|
|
|
}
|