index.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Container } from "../../ContainerBase";
  2. declare abstract class SequentialContainer<T> extends Container<T> {
  3. /**
  4. * @description Push the element to the back.
  5. * @param element The element you want to push.
  6. */
  7. abstract pushBack(element: T): void;
  8. /**
  9. * @description Removes the last element.
  10. */
  11. abstract popBack(): void;
  12. /**
  13. * @description Sets element by position.
  14. * @param pos The position you want to change.
  15. * @param element The element's value you want to update.
  16. */
  17. abstract setElementByPos(pos: number, element: T): void;
  18. /**
  19. * @description Removes the elements of the specified value.
  20. * @param value The value you want to remove.
  21. */
  22. abstract eraseElementByValue(value: T): void;
  23. /**
  24. * @description Insert several elements after the specified position.
  25. * @param pos The position you want to insert.
  26. * @param element The element you want to insert.
  27. * @param num The number of elements you want to insert (default 1).
  28. */
  29. abstract insert(pos: number, element: T, num?: number): void;
  30. /**
  31. * @description Reverses the container.
  32. */
  33. abstract reverse(): void;
  34. /**
  35. * @description Removes the duplication of elements in the container.
  36. */
  37. abstract unique(): void;
  38. /**
  39. * @description Sort the container.
  40. * @param cmp Comparison function.
  41. */
  42. abstract sort(cmp?: (x: T, y: T) => number): void;
  43. }
  44. export default SequentialContainer;