Package ucar.array
Class Array<T>
- java.lang.Object
-
- ucar.array.Array<T>
-
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
ArrayVlen
,StructureDataArray
@Immutable public abstract class Array<T> extends Object implements Iterable<T>
Superclass for implementations of multidimensional arrays.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
contains(int... index)
Check if the given index is valid.boolean
equals(Object o)
Equal if the type and indexFn are equal, doesnt test the contents.abstract T
get(int... index)
Get the element indicated by the list of multidimensional indices.abstract T
get(Index index)
Get the element indicated by Index.ArrayType
getArrayType()
The ArrayType for this Array.Index
getIndex()
An Index that can be used instead of int[], with the same rank as this Array.int
getRank()
Get the number of dimensions of the array.T
getScalar()
Get the first element of the ArraySection
getSection()
Get the section: list of Ranges, one for each dimension.int[]
getShape()
Get the shape: length of array in each dimension.long
getSize()
Get the total Number of elementsint
hashCode()
Consistent with equals.boolean
isVlen()
Is variable length and will be represented by Vlen<T>abstract Iterator<T>
iterator()
Iterates in canonical order over all the elements of the Array.long
length()
Get the total number of elements in the array.String
show()
String
toString()
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
iterator
public abstract Iterator<T> iterator()
Iterates in canonical order over all the elements of the Array.
-
get
public abstract T get(int... index)
Get the element indicated by the list of multidimensional indices.- Parameters:
index
- list of indices, one for each dimension. For vlen, the last is ignored.
-
get
public abstract T get(Index index)
Get the element indicated by Index.- Parameters:
index
- multidimensional indices.
-
getScalar
public T getScalar()
Get the first element of the Array
-
getArrayType
public ArrayType getArrayType()
The ArrayType for this Array. Note that ArrayType.CHAR is represented by an Array<Byte>.
-
isVlen
public boolean isVlen()
Is variable length and will be represented by Vlen<T>
-
getIndex
public Index getIndex()
An Index that can be used instead of int[], with the same rank as this Array.
-
getRank
public int getRank()
Get the number of dimensions of the array.
-
getShape
public int[] getShape()
Get the shape: length of array in each dimension. Use Ints.asList() to convert to List of Integer
-
getSize
public long getSize()
Get the total Number of elements
-
getSection
public Section getSection()
Get the section: list of Ranges, one for each dimension.
-
length
public long length()
Get the total number of elements in the array. Excludes vlen dimensins.
-
show
public String show()
-
equals
public boolean equals(Object o)
Equal if the type and indexFn are equal, doesnt test the contents.
-
contains
public boolean contains(int... index)
Check if the given index is valid.
-
-