Array.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (c) 2001 Per M.A. Bothner and Brainfood Inc.
  2. // This is free software; for terms and warranty disclaimer see ./COPYING.
  3. package gnu.lists;
  4. /** General interface to arrays of arbitrary dimension. */
  5. public interface Array<E>
  6. {
  7. public boolean isEmpty();
  8. /**
  9. * Get the rank (number of dimensions) of this array.
  10. * The rank of a scalar is 0, of a Sequence is 1, of a matrix is 2, etc.
  11. */
  12. public int rank();
  13. public int getElementKind();
  14. int effectiveIndex();
  15. int effectiveIndex(int index);
  16. int effectiveIndex(int i, int j);
  17. int effectiveIndex(int i, int j, int k, int... rest);
  18. public int effectiveIndex(int[] indexes);
  19. /** Given an "effective index", return element as object. */
  20. E getRaw(int index);
  21. boolean getBooleanRaw(int index);
  22. char getCharRaw(int index);
  23. byte getByteRaw(int index);
  24. short getShortRaw(int index);
  25. int getIntRaw(int index);
  26. long getLongRaw(int index);
  27. float getFloatRaw(int index);
  28. double getDoubleRaw(int index);
  29. void setRaw(int index, E value);
  30. public E get();
  31. public E get(int i);
  32. public E get(int i, int j);
  33. public E get(int i, int j, int k, int... rest);
  34. public E get(int[] indexes);
  35. public void set(int[] indexes, E value);
  36. public int getInt();
  37. public int getInt(int arg1);
  38. public int getInt(int arg1, int arg2);
  39. public int getInt(int arg1, int arg2, int arg3, int... rest);
  40. public int getInt(int[] args);
  41. public E getRowMajor(int index);
  42. public Array<E> asImmutable();
  43. /** Get the least dimension along the specified dimension. */
  44. public int getLowBound(int dim);
  45. /** Get length along specified dimension. */
  46. public int getSize(int dim);
  47. /** Total number of elements.
  48. * Same as the product of getSize(S) for all S. */
  49. public int getSize();
  50. }