public class Dimension extends 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 Dimensions will be immutable in 6. TODO Dimensions will not have a reference to their owning Group 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,
Dimension from)
Deprecated.
Use Dimension.builder()
|
Dimension(String name,
int length)
Constructor
|
Dimension(String name,
int length,
boolean isShared)
Deprecated.
Use Dimension.builder()
|
Dimension(String name,
int length,
boolean isShared,
boolean isUnlimited,
boolean isVariableLength)
Deprecated.
Use Dimension.builder()
|
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) |
Group |
getGroup()
Deprecated.
Do not use.
|
int |
getLength()
Get the length 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 unlimited, then the length can increase; otherwise it is immutable.
|
boolean |
isVariableLength()
If variable length, then the length is unknown until the data is read.
|
static List<Dimension> |
makeDimensionsAnon(int[] shape)
Deprecated.
use Dimensions.makeDimensionsAnon()
|
static List<Dimension> |
makeDimensionsList(Group parentGroup,
String dimString)
Deprecated.
use Group.makeDimensionsList()
|
static List<Dimension> |
makeDimensionsList(List<Dimension> dimensions,
String dimString)
Deprecated.
use Dimensions.makeDimensionsList()
|
static String |
makeDimensionsString(List<Dimension> dimensions)
Deprecated.
use Dimensions.makeDimensionsString()
|
String |
makeFullName()
Deprecated.
Do not use.
|
void |
setGroup(Group g)
Deprecated.
Use Dimension.builder()
|
Dimension |
setImmutable()
Deprecated.
Use Dimension.builder()
|
void |
setLength(int n)
Deprecated.
Use Dimension.builder()
|
String |
setName(String name)
Deprecated.
Use Dimension.builder()
|
void |
setShared(boolean b)
Deprecated.
Use Dimension.builder()
|
void |
setUnlimited(boolean b)
Deprecated.
Use Dimension.builder()
|
void |
setVariableLength(boolean b)
Deprecated.
Use Dimension.builder()
|
Dimension.Builder |
toBuilder()
Turn into a mutable Builder, use toBuilder().build() to make a copy.
|
String |
toString() |
String |
writeCDL(boolean strict)
Deprecated.
use CDLWriter
|
annotate, annotation, getDODSName, getFullName, getFullNameEscaped, getImmutable, getName, getParentGroup, getParentStructure, getShortName, getSort, isMemberOfStructure, localhash, setDODSName, setParentGroup, setParentStructure, setShortName, setSort, unwrap
public static final Dimension VLEN
public Dimension(String name, int length)
name
- name must be unique within grouplength
- length of Dimension@Deprecated public Dimension(String name, int length, boolean isShared)
name
- name must be unique within grouplength
- length, or UNLIMITED.length or UNKNOWN.lengthisShared
- whether its shared or local to Variable.@Deprecated public 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.@Deprecated public Dimension(String name, Dimension from)
name
- name must be unique within group. Can be null only if not shared.from
- copy all other fields from here.@Deprecated public static String makeDimensionsString(List<Dimension> dimensions)
@Deprecated public static List<Dimension> makeDimensionsList(Group parentGroup, String dimString) throws IllegalArgumentException
parentGroup
- containing group, may not be nulldimString
- : whitespace separated list of dimension names, or '*' for Dimension.UNKNOWN, or number for anon
dimension. null or empty String is a scalar.IllegalArgumentException
- if cant find dimension or parse error.@Deprecated public static List<Dimension> makeDimensionsList(List<Dimension> dimensions, String dimString)
dimensions
- list of possible dimensions, may not be nulldimString
- : whitespace separated list of dimension names, or '*' for Dimension.UNKNOWN, or number for anon
dimension. null or empty String is a scalar.IllegalArgumentException
- if cant find dimension or parse error.@Deprecated public static List<Dimension> makeDimensionsAnon(int[] shape)
public Dimension.Builder toBuilder()
public int getLength()
public boolean isUnlimited()
public boolean isVariableLength()
public boolean isShared()
@Deprecated public Group getGroup()
@Deprecated public String makeFullName()
public int hashCode()
public int compareTo(Dimension odim)
compareTo
in interface Comparable<Dimension>
odim
- compare to this Dimension@Deprecated public String writeCDL(boolean strict)
strict
- if true, write in strict adherence to CDL definition.@Deprecated public void setUnlimited(boolean b)
b
- true if unlimited@Deprecated public void setVariableLength(boolean b)
b
- true if variable length@Deprecated public void setShared(boolean b)
b
- true if shared@Deprecated public void setLength(int n)
n
- length of Dimension@Deprecated public String setName(String name)
name
- set to this value@Deprecated public void setGroup(Group g)
g
- parent group@Deprecated public Dimension setImmutable()
setImmutable
in class CDMNode
public static Dimension.Builder builder()
public static Dimension.Builder builder(String name, int length)