Package uk.ac.rdg.resc.edal.util
Class Array2D<T>
- java.lang.Object
-
- uk.ac.rdg.resc.edal.util.Array2D<T>
-
- All Implemented Interfaces:
Serializable
,Iterable<T>
,Array<T>
- Direct Known Subclasses:
LegendDataGenerator.XYNan
,ValuesArray2D
public abstract class Array2D<T> extends Object implements Array<T>, Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Array2D(int ySize, int xSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNDim()
Gets the number of dimensions of the array.int[]
getShape()
Gets the shape of the array, i.e.int
getXIndex()
int
getXSize()
Convenience method to get the size in the x-directionint
getYIndex()
int
getYSize()
Convenience method to get the size in the y-directionIterator<T>
iterator()
Returns an iterator over all the values in the array.void
set(T value, int... coords)
Sets a value in the array (optional operation)long
size()
Gets the number of values in the array.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
X_IND
protected static final int X_IND
- See Also:
- Constant Field Values
-
Y_IND
protected static final int Y_IND
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNDim
public final int getNDim()
Description copied from interface:Array
Gets the number of dimensions of the array. Equal to getShape().length.
-
iterator
public Iterator<T> iterator()
Description copied from interface:Array
Returns an iterator over all the values in the array. The convention is that the last dimension (represented by the last entry in getShape()) varies fastest.
-
set
public void set(T value, int... coords)
Description copied from interface:Array
Sets a value in the array (optional operation)
-
size
public long size()
Description copied from interface:Array
Gets the number of values in the array.
-
getShape
public int[] getShape()
Description copied from interface:Array
Gets the shape of the array, i.e. the number of points in each direction.
-
getXSize
public int getXSize()
Convenience method to get the size in the x-direction
-
getYSize
public int getYSize()
Convenience method to get the size in the y-direction
-
getXIndex
public int getXIndex()
- Returns:
- The index used for x values
-
getYIndex
public int getYIndex()
- Returns:
- The index used for y values
-
-