## ucar.netcdf
Class Dimension

    java.lang.Object
      ucar.netcdf.Dimension

All Implemented Interfaces:
  Cloneable, Named, Serializable

Direct Known Subclasses:
  UnlimitedDimension

public class Dimension
extends Object
implements Named, Serializable, Cloneable

A Dimension object is used to contain an array length which is named for use in multiple netcdf variables.

This class supports construction, retrieval of the name and retrieval of the length value. The name is constant over the lifetime of the object. Also note that change of the dimension length value is not allowed. In the subclass UnlimitedDimension, the length may be increased.

Instances which have same name and same value are equal. We override hashCode() and equals() to be consistent with this semantic.

See Also:
  `UnlimitedDimension`, Serialized Form

Field Summary
`protected int` `length` The length.

Constructor Summary
`Dimension(String name, int length)`

Method Summary
`Object` `clone()`
`boolean` `equals(Object oo)` Instances which have same name and same value are equal.
`int` `getLength()` Retrieve the length.
`String` `getName()` Returns the name of this Dimension.
`int` `hashCode()` Instances which have same name and same value are equal.
`void` `toCdl(StringBuffer buf)` Format as CDL.
`String` `toString()`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### length

    protected int length

  The length. Immutable in this class.

Constructor Detail

### Dimension

    public Dimension(String name,
                     int length)

Parameters:
  `name` - String which is to be the name of this Dimension
  `length` - int length of this Dimension

Method Detail

### hashCode

    public int hashCode()

  Instances which have same name and same value are equal. Overrides Object.hashCode() to be consistent with this semantic.

### equals

    public boolean equals(Object oo)

  Instances which have same name and same value are equal. Overrides Object.hashCode() to be consistent with this semantic.

### clone

    public Object clone()

### toString

    public String toString()

  Returns:
    a string representation of the object.

### getName

    public final String getName()

  Returns the name of this Dimension.

  Specified by:
    `getName` in interface `Named`
  Returns:
    String which identifies this Dimension.

### getLength

    public final int getLength()

  Retrieve the length.

  Returns:
    int which is the length of this Dimension

### toCdl

    public void toCdl(StringBuffer buf)

  Format as CDL.

  Parameters:
    `buf` - StringBuffer into which to write