PackedArray.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * A Packed array of signed 64 bit values, and supports {@link #get get()}, {@link #set set()},
  3. * {@link #add add()} and {@link #increment increment()} operations on the logical contents of the array.
  4. *
  5. * An {@link PackedLongArray} Uses {@link PackedArrayContext} to track
  6. * the array's logical contents. Contexts may be switched when a context requires resizing
  7. * to complete logical array operations (get, set, add, increment). Contexts are
  8. * established and used within critical sections in order to facilitate concurrent
  9. * implementors.
  10. *
  11. */
  12. export declare class PackedArray {
  13. private arrayContext;
  14. constructor(virtualLength: number, initialPhysicalLength?: number);
  15. setVirtualLength(newVirtualArrayLength: number): void;
  16. /**
  17. * Get value at virtual index in the array
  18. * @param index the virtual array index
  19. * @return the array value at the virtual index given
  20. */
  21. get(index: number): number;
  22. /**
  23. * Increment value at a virrual index in the array
  24. * @param index virtual index of value to increment
  25. */
  26. increment(index: number): void;
  27. private safeGetPackedIndexgetPackedIndex;
  28. /**
  29. * Add to a value at a virtual index in the array
  30. * @param index the virtual index of the value to be added to
  31. * @param value the value to add
  32. */
  33. add(index: number, value: number): void;
  34. /**
  35. * Set the value at a virtual index in the array
  36. * @param index the virtual index of the value to set
  37. * @param value the value to set
  38. */
  39. set(index: number, value: number): void;
  40. /**
  41. * Get the current physical length (in longs) of the array's backing storage
  42. * @return the current physical length (in longs) of the array's current backing storage
  43. */
  44. getPhysicalLength(): number;
  45. /**
  46. * Get the (virtual) length of the array
  47. * @return the (virtual) length of the array
  48. */
  49. length(): number;
  50. /**
  51. * Clear the array contents
  52. */
  53. clear(): void;
  54. toString(): string;
  55. }