public class Dimension extends ucar.nc2.CDMNode implements java.lang.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(java.lang.String name,
int length)
Constructor
|
Dimension(java.lang.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(java.lang.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(java.lang.Object oo) |
int |
getLength()
Get the length of the Dimension.
|
java.lang.String |
getName()
Get the name of the Dimension.
|
java.lang.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.
|
java.lang.String |
toString() |
public static final Dimension VLEN
public Dimension(java.lang.String name, int length)
name
- name must be unique within grouplength
- length of Dimensionpublic Dimension(java.lang.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(java.lang.String name, int length)
public int compareTo(Dimension odim)
compareTo
in interface java.lang.Comparable<Dimension>
odim
- compare to this Dimensionpublic boolean equals(java.lang.Object oo)
equals
in class java.lang.Object
public int getLength()
public java.lang.String getName()
getName
in class ucar.nc2.CDMNode
public java.lang.String getShortName()
getShortName
in class ucar.nc2.CDMNode
public int hashCode()
hashCode
in class java.lang.Object
public boolean isShared()
public boolean isUnlimited()
public boolean isVariableLength()
public Dimension.Builder toBuilder()
public java.lang.String toString()
toString
in class java.lang.Object