public class Dimension extends ucar.nc2.CDMNode implements Comparable<Dimension>
Immutable if setImmutable() was called, except for an Unlimited Dimension, whose size can change.
Note: this class has a natural ordering that is inconsistent with equals. TODO Dimension will be immutable in 6. TODO Dimension will not extend CDMNode in 6. TODO Dimension will not have a reference to its owning Group in 6. TODO Dimension.getFullName() will not exist in 6.
Modifier and Type | Class and Description |
---|---|
static class |
Dimension.Builder
A builder of Dimensions.
|
Modifier and Type | Field and Description |
---|---|
static Dimension |
VLEN
A variable-length dimension: the length is not known until the data is read.
|
Constructor and Description |
---|
Dimension(String name,
int length)
Constructor
|
Dimension(String name,
int length,
boolean isShared,
boolean isUnlimited,
boolean isVariableLength)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static Dimension.Builder |
builder() |
static Dimension.Builder |
builder(String name,
int length)
A builder with the Dimension name and length set
|
int |
compareTo(Dimension odim)
Dimensions with the same name are equal.
|
boolean |
equals(Object oo) |
int |
getLength()
Get the length of the Dimension.
|
String |
getName()
Get the name of the Dimension.
|
String |
getShortName()
Get the name of the Dimension.
|
int |
hashCode()
Override Object.hashCode() to implement equals.
|
boolean |
isShared()
If this Dimension is shared, or is private to a Variable.
|
boolean |
isUnlimited()
If this is a NetCDF unlimited dimension.
|
boolean |
isVariableLength()
If variable length, then the length is unknown until the data is read.
|
Dimension.Builder |
toBuilder()
Turn into a mutable Builder, use toBuilder().build() to make a copy.
|
String |
toString() |
public static final Dimension VLEN
public Dimension(String name, int length)
name
- name must be unique within grouplength
- length of Dimensionpublic Dimension(String name, int length, boolean isShared, boolean isUnlimited, boolean isVariableLength)
name
- name must be unique within group. Can be null only if not shared.length
- length, or UNLIMITED.length or UNKNOWN.lengthisShared
- whether its shared or local to Variable.isUnlimited
- whether the length can grow.isVariableLength
- whether the length is unknown until the data is read.public static Dimension.Builder builder()
public static Dimension.Builder builder(String name, int length)
public int compareTo(Dimension odim)
compareTo
in interface Comparable<Dimension>
odim
- compare to this Dimensionpublic int getLength()
public String getName()
getName
in class ucar.nc2.CDMNode
public String getShortName()
getShortName
in class ucar.nc2.CDMNode
public int hashCode()
public boolean isShared()
public boolean isUnlimited()
public boolean isVariableLength()
public Dimension.Builder toBuilder()