d687dd53d75b9e86aa600339714d1816cee1472a1af51c86eb0ed693d76c5d4a7c18fa9d1a52147f4c42002e7fa4591e6c4bef7e506434cd26cdf70dcc8aba 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import SequentialContainer from './Base';
  2. import { initContainer, IteratorType } from "../ContainerBase";
  3. import { RandomIterator } from "./Base/RandomIterator";
  4. declare class VectorIterator<T> extends RandomIterator<T> {
  5. container: Vector<T>;
  6. constructor(node: number, container: Vector<T>, iteratorType?: IteratorType);
  7. copy(): VectorIterator<T>;
  8. equals(iter: VectorIterator<T>): boolean;
  9. }
  10. export type { VectorIterator };
  11. declare class Vector<T> extends SequentialContainer<T> {
  12. /**
  13. * @param container - Initialize container, must have a forEach function.
  14. * @param copy - When the container is an array, you can choose to directly operate on the original object of
  15. * the array or perform a shallow copy. The default is shallow copy.
  16. */
  17. constructor(container?: initContainer<T>, copy?: boolean);
  18. clear(): void;
  19. begin(): VectorIterator<T>;
  20. end(): VectorIterator<T>;
  21. rBegin(): VectorIterator<T>;
  22. rEnd(): VectorIterator<T>;
  23. front(): T | undefined;
  24. back(): T | undefined;
  25. getElementByPos(pos: number): T;
  26. eraseElementByPos(pos: number): number;
  27. eraseElementByValue(value: T): number;
  28. eraseElementByIterator(iter: VectorIterator<T>): VectorIterator<T>;
  29. pushBack(element: T): number;
  30. popBack(): T | undefined;
  31. setElementByPos(pos: number, element: T): void;
  32. insert(pos: number, element: T, num?: number): number;
  33. find(element: T): VectorIterator<T>;
  34. reverse(): void;
  35. unique(): number;
  36. sort(cmp?: (x: T, y: T) => number): void;
  37. forEach(callback: (element: T, index: number, vector: Vector<T>) => void): void;
  38. [Symbol.iterator](): Generator<T, void, undefined>;
  39. }
  40. export default Vector;