IMapStorage.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { TDictionary } from '../../types/TDictionary';
  2. import { IInitializable } from '../IInitializable';
  3. export interface IMapStorage <K, V> extends IInitializable {
  4. /**
  5. * @param {K} key
  6. * @returns {V | undefined}
  7. */
  8. get (key: K): V | undefined;
  9. /**
  10. * @param {K} key
  11. * @returns {V}
  12. */
  13. getOrThrow (key: K): V;
  14. /**
  15. * @param {V} value
  16. * @returns {K | null}
  17. */
  18. getKeyOf (value: V): K | null;
  19. /**
  20. * @returns number
  21. */
  22. getLength (): number;
  23. /**
  24. * @returns {Map<K, V>}
  25. */
  26. getStorage (): Map <K, V>;
  27. /**
  28. * @returns {TDictionary<V>}
  29. */
  30. getStorageAsDictionary (): TDictionary<V>;
  31. /**
  32. * @returns string
  33. */
  34. getStorageId (): string;
  35. /**
  36. * @param {K} key
  37. * @returns {boolean}
  38. */
  39. has (key: K): boolean;
  40. /**
  41. * @param storage
  42. * @param mergeId
  43. */
  44. mergeWith (storage: this, mergeId: boolean): void;
  45. /**
  46. * @param {K} key
  47. * @param {V} value
  48. */
  49. set (key: K, value: V): void;
  50. /**
  51. * @returns string
  52. */
  53. toString (): string;
  54. }