Документ взят из кэша поисковой машины. Адрес оригинального документа : http://angel.cs.msu.su/projects/system/toolsdoc/netcdf_java/ucar/netcdf/ProtoVariable.html
Дата изменения: Tue Dec 28 20:59:06 2004
Дата индексирования: Sun Apr 10 00:15:49 2016
Кодировка:
: Class ProtoVariable

ucar.netcdf
Class ProtoVariable

java.lang.Object
  |
  +--ucar.netcdf.ProtoVariable
All Implemented Interfaces:
java.lang.Cloneable, MultiArrayInfo, ucar.netcdf.Named, java.io.Serializable

public class ProtoVariable
extends java.lang.Object
implements ucar.netcdf.Named, MultiArrayInfo, java.io.Serializable, java.lang.Cloneable

Prototype for Netcdf Variable. Instances of ProtoVariable provide the description of a Netcdf Variable without data i/o functionality. Instances of this class are used in a Schema, which is used when we create a new Netcdf. An instance has a name and a shape specified by an array of Dimensions. It may also have descriptive attributes. The attribute set is modifiable.

The data logically contained in a Netcdf Variable is not accessed through this object.

Although there is no explicit relationship between this class and and Variable, they share common method signatures and semantics where appropriate.

See Also:
Variable, Serialized Form

Constructor Summary
ProtoVariable(java.lang.String name, java.lang.Class componentType, Dimension dimension)
          Convenience constructor for 1-dimensional Variables, often used for coordinate variables.
ProtoVariable(java.lang.String name, java.lang.Class componentType, Dimension[] dimArray)
          The usual constructor, used when you are going to add the attributes after construction.
ProtoVariable(java.lang.String name, java.lang.Class componentType, Dimension[] dimArray, Attribute[] attrArray)
          More general constructor.
ProtoVariable(Variable var)
          Conversion constructor.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this
 Attribute getAttribute(java.lang.String name)
          Convenience function; look up Attribute by name.
 AttributeSet getAttributes()
          Returns the (modifiable) set of attributes associated with this.
 java.lang.Class getComponentType()
          Returns the Class object representing the component type of the Variable.
 DimensionIterator getDimensionIterator()
          Returns a DimensionIterator of the dimensions used by this variable.
 int[] getLengths()
          Return an array whose length is the rank of this and whose elements represent the length of each of its dimensions.
 java.lang.String getName()
          Returns the name of this Variable.
 int getRank()
          Returns the number of dimensions of the variable.
 boolean isScalar()
          Convenience interface; return true if and only if the rank is zero.
 boolean isUnlimited()
          Returns true if and only if the this variable can grow.
 Attribute putAttribute(Attribute attr)
          Convenience function; add attribute.
 void toCdl(java.lang.StringBuffer buf)
          Format as CDL.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProtoVariable

public ProtoVariable(java.lang.String name,
                     java.lang.Class componentType,
                     Dimension[] dimArray)
The usual constructor, used when you are going to add the attributes after construction.
Parameters:
name - String which is to be the name of this Variable
componentType - Class (primitive type) contained herein. One of Character.Type, Byte.TYPE, Short.TYPE, Integer.TYPE, Float.TYPE, or Double.Type.
dimArray - The dimensions which define the shape of this Variable. If null or zero length array, this is a scalar variable.

ProtoVariable

public ProtoVariable(java.lang.String name,
                     java.lang.Class componentType,
                     Dimension dimension)
Convenience constructor for 1-dimensional Variables, often used for coordinate variables. Typically attributes would be added after construction when this constructor is used.
Parameters:
name - String which is to be the name of this Variable
componentType - Class (primitive type) contained herein. One of Character.Type, Byte.TYPE, Short.TYPE, Integer.TYPE, Float.TYPE, or Double.Type.
dimension - A single dimension to define the array.

ProtoVariable

public ProtoVariable(java.lang.String name,
                     java.lang.Class componentType,
                     Dimension[] dimArray,
                     Attribute[] attrArray)
More general constructor. Initializes attribute set during construction.
Parameters:
name - String which is to be the name of this Variable
componentType - Class (primitive type) contained herein. One of Character.Type, Byte.TYPE, Short.TYPE, Integer.TYPE, Float.TYPE, or Double.Type.
dimArray - The dimensions which define the shape of this Variable. If null or zero length array, this is a scalar variable.
attrArray - Attributes associated with this Variable. May be null or a zero length array.

ProtoVariable

public ProtoVariable(Variable var)
Conversion constructor.
Method Detail

clone

public java.lang.Object clone()
Returns a clone of this
Overrides:
clone in class java.lang.Object

getName

public final java.lang.String getName()
Returns the name of this Variable.
Specified by:
getName in interface ucar.netcdf.Named
Returns:
String which identifies this Variable.

getComponentType

public final java.lang.Class getComponentType()
Returns the Class object representing the component type of the Variable.
Specified by:
getComponentType in interface MultiArrayInfo
Returns:
Class The componentType
See Also:
Class.getComponentType()

getRank

public final int getRank()
Returns the number of dimensions of the variable.
Specified by:
getRank in interface MultiArrayInfo
Returns:
int number of dimensions of the variable

getLengths

public final int[] getLengths()
Return an array whose length is the rank of this and whose elements represent the length of each of its dimensions.
Specified by:
getLengths in interface MultiArrayInfo
Returns:
int array whose length is the rank of this and whose elements represent the length of each of its dimensions

isUnlimited

public final boolean isUnlimited()
Returns true if and only if the this variable can grow. This is equivalent to saying at least one of its dimensions is unlimited. In the current implementation, exactly one dimension, the most slowly varying (leftmost), can be unlimited.
Specified by:
isUnlimited in interface MultiArrayInfo
Returns:
boolean true iff this can grow

isScalar

public final boolean isScalar()
Convenience interface; return true if and only if the rank is zero.
Specified by:
isScalar in interface MultiArrayInfo
Returns:
boolean true iff rank == 0

getDimensionIterator

public DimensionIterator getDimensionIterator()
Returns a DimensionIterator of the dimensions used by this variable. The most slowly varying (leftmost for java and C programmers) dimension is first. For scalar variables, the set has no elements and the iteration is empty.
Returns:
DimensionIterator of the elements.
See Also:
DimensionIterator

getAttribute

public Attribute getAttribute(java.lang.String name)
Convenience function; look up Attribute by name.
Parameters:
name - the name of the attribute
Returns:
the attribute, or null if not found

getAttributes

public AttributeSet getAttributes()
Returns the (modifiable) set of attributes associated with this.
Returns:
AttributeSet. May be empty. Won't be null.

putAttribute

public Attribute putAttribute(Attribute attr)
Convenience function; add attribute.
Parameters:
attr - the Attribute to be added to this set.
Returns:
Attribute replaced or null if not a replacement
See Also:
AttributeSet.put(ucar.netcdf.Attribute)

toCdl

public void toCdl(java.lang.StringBuffer buf)
Format as CDL.
Parameters:
buf - StringBuffer into which to write

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this