59a239fd563d2898f3ee6a389bcdbf55674b21d62d06e425bafc45a325d097b4ea7f52c1cf7d92fe050a71efdc5f1b21693a76008742616e86ee0bb7000d8a 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { initContainer, IteratorType } from "../ContainerBase";
  2. import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base";
  3. declare class HashSetIterator<K> extends HashContainerIterator<K, undefined> {
  4. readonly container: HashSet<K>;
  5. constructor(node: HashLinkNode<K, undefined>, header: HashLinkNode<K, undefined>, container: HashSet<K>, iteratorType?: IteratorType);
  6. get pointer(): K;
  7. copy(): HashSetIterator<K>;
  8. equals(iter: HashSetIterator<K>): boolean;
  9. }
  10. export type { HashSetIterator };
  11. declare class HashSet<K> extends HashContainer<K, undefined> {
  12. constructor(container?: initContainer<K>);
  13. begin(): HashSetIterator<K>;
  14. end(): HashSetIterator<K>;
  15. rBegin(): HashSetIterator<K>;
  16. rEnd(): HashSetIterator<K>;
  17. front(): K | undefined;
  18. back(): K | undefined;
  19. /**
  20. * @description Insert element to set.
  21. * @param key - The key want to insert.
  22. * @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
  23. * If a `undefined` value is passed in, the type will be automatically judged.
  24. * @returns The size of container after inserting.
  25. */
  26. insert(key: K, isObject?: boolean): number;
  27. getElementByPos(pos: number): K;
  28. /**
  29. * @description Check key if exist in container.
  30. * @param key - The element you want to search.
  31. * @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
  32. * If a `undefined` value is passed in, the type will be automatically judged.
  33. * @returns An iterator pointing to the element if found, or super end if not found.
  34. */
  35. find(key: K, isObject?: boolean): HashSetIterator<K>;
  36. forEach(callback: (element: K, index: number, container: HashSet<K>) => void): void;
  37. [Symbol.iterator](): Generator<K, void, unknown>;
  38. }
  39. export default HashSet;