Interface MultiDimensionalCollection<T>

Type Parameters:
T - the type of the data stored in the collection
All Known Implementing Classes:
MultiDimensionalArray

public interface MultiDimensionalCollection<T>
A generic collection with an arbitrary number of dimensions. Crucially, it does not require the number of dimensions to be specified at compile time. For example, this is useful when the indices represent independent variables and the number of independent variables may change.

Dimension in this case can be thought of as the number of indices. For example, a three-dimensional collection may have 10x10x10 elements and hence requires three indices.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of dimensions of the collection.
    get(int... indices)
    Returns the element at the specified position in this collection.
    set(T element, int... indices)
    Replaces the element at the specified position in this list with the specified element.
    int
    size(int i)
    Returns the size of the collection along the given dimension.
  • Method Details

    • set

      T set(T element, int... indices)
      Replaces the element at the specified position in this list with the specified element.
      Parameters:
      element - element to be stored at the specified position
      indices - the indices of the element to replace
    • get

      T get(int... indices)
      Returns the element at the specified position in this collection.
      Parameters:
      indices - the indices of the element to return
      Returns:
      the element at the specified position in the list
    • size

      int size(int i)
      Returns the size of the collection along the given dimension.
      Parameters:
      i - the index of the dimension for which to determine the size
      Returns:
      the size of the collection along the given dimension
    • dimension

      int dimension()
      Returns the number of dimensions of the collection.
      Returns:
      the number of dimensions