Class ArrayAnyD<N extends java.lang.Comparable<N>>

    • Constructor Detail

      • ArrayAnyD

        private ArrayAnyD()
      • ArrayAnyD

        ArrayAnyD​(BasicArray<N> delegate,
                  long[] structure)
    • Method Detail

      • add

        public void add​(long index,
                        java.lang.Comparable<?> addend)
        Specified by:
        add in interface Mutate1D.Modifiable<N extends java.lang.Comparable<N>>
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long[] reference,
                        byte addend)
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long[] reference,
                        java.lang.Comparable<?> addend)
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long[] reference,
                        double addend)
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long[] reference,
                        float addend)
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long[] reference,
                        int addend)
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long[] reference,
                        long addend)
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long[] reference,
                        short addend)
        Specified by:
        add in interface MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
      • byteValue

        public byte byteValue​(int index)
        Specified by:
        byteValue in interface Access1D<N extends java.lang.Comparable<N>>
      • byteValue

        public byte byteValue​(long index)
        Specified by:
        byteValue in interface Access1D<N extends java.lang.Comparable<N>>
      • byteValue

        public byte byteValue​(long... ref)
        Specified by:
        byteValue in interface AccessAnyD<N extends java.lang.Comparable<N>>
      • count

        public long count()
        Description copied from interface: Structure1D
        The total number of elements in this structure.

        You only need to implement this method if the structure can contain more than Integer.MAX_VALUE elements.

        Specified by:
        count in interface Structure1D
      • count

        public long count​(int dimension)
        Description copied from interface: StructureAnyD
        count() == count(0) * count(1) * count(2) * count(3) * ...
        Specified by:
        count in interface StructureAnyD
      • doubleValue

        public double doubleValue​(int index)
        Specified by:
        doubleValue in interface Access1D<N extends java.lang.Comparable<N>>
      • doubleValue

        public double doubleValue​(long index)
        Specified by:
        doubleValue in interface Access1D<N extends java.lang.Comparable<N>>
      • doubleValue

        public double doubleValue​(long... ref)
        Specified by:
        doubleValue in interface AccessAnyD<N extends java.lang.Comparable<N>>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • fillRange

        public void fillRange​(long first,
                              long limit,
                              N value)
        Specified by:
        fillRange in interface Mutate1D.Fillable<N extends java.lang.Comparable<N>>
      • fillSet

        public void fillSet​(int dimension,
                            long dimensionalIndex,
                            N value)
        Specified by:
        fillSet in interface MutateAnyD.Fillable<N extends java.lang.Comparable<N>>
      • fillSet

        public void fillSet​(long[] initial,
                            int dimension,
                            N value)
        Specified by:
        fillSet in interface MutateAnyD.Fillable<N extends java.lang.Comparable<N>>
      • floatValue

        public float floatValue​(int index)
        Specified by:
        floatValue in interface Access1D<N extends java.lang.Comparable<N>>
      • floatValue

        public float floatValue​(long index)
        Specified by:
        floatValue in interface Access1D<N extends java.lang.Comparable<N>>
      • floatValue

        public float floatValue​(long... ref)
        Specified by:
        floatValue in interface AccessAnyD<N extends java.lang.Comparable<N>>
      • get

        public N get​(long index)
        Specified by:
        get in interface Access1D<N extends java.lang.Comparable<N>>
      • get

        public N get​(long... ref)
        Specified by:
        get in interface AccessAnyD<N extends java.lang.Comparable<N>>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • intValue

        public int intValue​(int index)
        Specified by:
        intValue in interface Access1D<N extends java.lang.Comparable<N>>
      • intValue

        public int intValue​(long index)
        Specified by:
        intValue in interface Access1D<N extends java.lang.Comparable<N>>
      • intValue

        public int intValue​(long... ref)
        Specified by:
        intValue in interface AccessAnyD<N extends java.lang.Comparable<N>>
      • longValue

        public long longValue​(int index)
        Specified by:
        longValue in interface Access1D<N extends java.lang.Comparable<N>>
      • longValue

        public long longValue​(long index)
        Specified by:
        longValue in interface Access1D<N extends java.lang.Comparable<N>>
      • longValue

        public long longValue​(long... ref)
        Specified by:
        longValue in interface AccessAnyD<N extends java.lang.Comparable<N>>
      • rank

        public int rank()
        Specified by:
        rank in interface StructureAnyD
        Returns:
        The number of dimensions (the number of indices used to reference one element)
      • reduce

        public Array1D<N> reduce​(int dimension,
                                 Aggregator aggregator)
        Specified by:
        reduce in interface StructureAnyD.ReducibleTo1D<N extends java.lang.Comparable<N>>
        Parameters:
        dimension - Which of the AnyD-dimensions should be mapped to the resulting 1D structure.
        aggregator - How to aggregate the values of the reduction
        Returns:
        A 1D data structure with aggregated values
      • reduce

        public Array2D<N> reduce​(int rowDim,
                                 int colDim,
                                 Aggregator aggregator)
        Specified by:
        reduce in interface StructureAnyD.ReducibleTo2D<N extends java.lang.Comparable<N>>
        Parameters:
        rowDim - Which of the AnyD-dimensions should be mapped to the rows of the resulting 2D structure.
        colDim - Which of the AnyD-dimensions should be mapped to the columns of the resulting 2D structure.
        aggregator - How to aggregate the values of the reduction
        Returns:
        A 2D data structure with aggregated values
      • reset

        public void reset()
        Description copied from interface: Mutate1D
        Reset this mutable structure to some standard (all zeros) initial state. It must still be usuable after this call, and the structure/size/shape must not change.
        Specified by:
        reset in interface Mutate1D
      • set

        public void set​(int index,
                        byte value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(int index,
                        double value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(int index,
                        float value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(int index,
                        int value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(int index,
                        long value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(int index,
                        short value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long index,
                        byte value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long index,
                        java.lang.Comparable<?> value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long index,
                        double value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long index,
                        float value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long index,
                        int value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long index,
                        long value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long index,
                        short value)
        Specified by:
        set in interface Mutate1D
      • set

        public void set​(long[] reference,
                        byte value)
        Specified by:
        set in interface MutateAnyD
      • set

        public void set​(long[] reference,
                        java.lang.Comparable<?> value)
        Specified by:
        set in interface MutateAnyD
      • set

        public void set​(long[] reference,
                        double value)
        Specified by:
        set in interface MutateAnyD
      • set

        public void set​(long[] reference,
                        float value)
        Specified by:
        set in interface MutateAnyD
      • set

        public void set​(long[] reference,
                        int value)
        Specified by:
        set in interface MutateAnyD
      • set

        public void set​(long[] reference,
                        long value)
        Specified by:
        set in interface MutateAnyD
      • set

        public void set​(long[] reference,
                        short value)
        Specified by:
        set in interface MutateAnyD
      • shortValue

        public short shortValue​(int index)
        Specified by:
        shortValue in interface Access1D<N extends java.lang.Comparable<N>>
      • shortValue

        public short shortValue​(long index)
        Specified by:
        shortValue in interface Access1D<N extends java.lang.Comparable<N>>
      • shortValue

        public short shortValue​(long... ref)
        Specified by:
        shortValue in interface AccessAnyD<N extends java.lang.Comparable<N>>
      • size

        public int size()
        Description copied from interface: Structure1D
        The total number of elements in this structure.
        Specified by:
        size in interface Structure1D
      • size

        public int size​(int dimension)
        Specified by:
        size in interface StructureAnyD
      • sliceSet

        public Array1D<N> sliceSet​(long[] initial,
                                   int dimension)
        Description copied from interface: AccessAnyD.Sliceable
        If the intial reference is {0, 2, 3} and the slice dimension is 1 then the sliced 1D view will map to the following elements in the AnyD data structure:
         0 => {0, 2, 3}
         1 => {0, 3, 3}
         2 => {0, 4, 3}
         3 => {0, 5, 3}
         4 => {0, 6, 3}
         5 => {0, 7, 3}
         6 => ...
         
        Meaning the row index is always '0', and the plane/matrix/area index is always '3', but the column index starts at '2' and then increments.

        If you have a data structure defined as 3 x 3 x n (that is n 3x3 matrices) and you want to access the second element of the first column of each of the matrices, then the intial refrence is {1, 0, 0} and the slice dimension is 2.

        Specified by:
        sliceSet in interface AccessAnyD.Sliceable<N extends java.lang.Comparable<N>>
        Parameters:
        initial - Indices pointing to what will be the first element of the sliced Access1D
        dimension - Which indices that make out an element reference should be incremented
        Returns:
        A sliced 1D view of the underlying AnyD data structure
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object