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

ucar.netcdf
Class AbstractNetcdf

java.lang.Object
  |
  +--ucar.netcdf.AbstractNetcdf
All Implemented Interfaces:
Netcdf
Direct Known Subclasses:
NetcdfFile, RemoteNetcdf

public abstract class AbstractNetcdf
extends java.lang.Object
implements Netcdf

This abstract class provides a skeletal implementation of the Netcdf interface.

A minimal concrete implementation would provide a concrete implementation of method Accessor ioFactory(ProtoVariable proto). It would also provide a constructor which takes a Schema argument and calls super(Schema) to get this class to hook everything up.

TODO: There is a lot more to be said.


Constructor Summary
protected AbstractNetcdf()
          Create an empty instance.
protected AbstractNetcdf(java.lang.Class varClass)
          Create an empty instance to be populated with instances of some subclass of Variable.
protected AbstractNetcdf(Schema sc, boolean init)
          Create an instance populated with instances of Variable.
protected AbstractNetcdf(Schema sc, boolean init, java.lang.Class varClass)
          Create an instance populated with instances of some subclass of Variable.
 
Method Summary
protected  void add(ProtoVariable proto, Accessor io)
          Used for incremental initialization.
 boolean contains(java.lang.Object oo)
          Tests if the argument is in this set.
 boolean contains(java.lang.String name)
          Tests if the Variable identified by name is in this set.
 Variable get(java.lang.String name)
          Retrieve the variable associated with the specified name.
 Attribute getAttribute(java.lang.String name)
          Convenience function; look up global Attribute by name.
 AttributeSet getAttributes()
          Returns the set of attributes associated with this, also know as the "global" attributes.
 DimensionSet getDimensions()
          Returns the set of dimensions associated with this, the union of those used by each of the variables.
protected  void initHashtable()
           
protected abstract  Accessor ioFactory(ProtoVariable proto)
          Used when creating variables to populate this.
 VariableIterator iterator()
          Returns VariableIterator for the elements.
protected  void putAttribute(Attribute attr)
          Used for incremental initialization.
protected  void putDimension(Dimension dim)
          Used for incremental initialization.
 int size()
          Returns the number of variables
 void toCdl(java.lang.StringBuffer buf)
          Format as CDL.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractNetcdf

protected AbstractNetcdf()
Create an empty instance. This may be incrementally populated using the protected put methods below. Use this constructor when you don't have all the ProtoVariables, Dimensions, and global Attributes available initially, such as when constructing from a stream.

AbstractNetcdf

protected AbstractNetcdf(java.lang.Class varClass)
                  throws java.lang.NoSuchMethodException
Create an empty instance to be populated with instances of some subclass of Variable.
Parameters:
varClass - Class object for some subclass of Variable. The class must implement a constructor of the form myVar(ProtoVariable proto, Accessor io) or NoSuchMethodException will be thrown.

AbstractNetcdf

protected AbstractNetcdf(Schema sc,
                         boolean init)
Create an instance populated with instances of Variable.
Parameters:
sc - the Schema to use. N.B. Not a copy. May be empty, shouldn't be null.
init - if true, call initHashtable()

AbstractNetcdf

protected AbstractNetcdf(Schema sc,
                         boolean init,
                         java.lang.Class varClass)
                  throws java.lang.NoSuchMethodException,
                         java.lang.InstantiationException,
                         java.lang.reflect.InvocationTargetException,
                         java.lang.IllegalAccessException
Create an instance populated with instances of some subclass of Variable.
Parameters:
sc - the Schema used as a template. May be empty, shouldn't be null.
init - if true, call initHashtable()
varClass - Class object for some subclass of Variable. The class must implement a constructor of the form myVar(ProtoVariable proto, Accessor io) or NoSuchMethodException will be thrown.
Method Detail

size

public int size()
Returns the number of variables
Specified by:
size in interface Netcdf
Returns:
int number of variables

iterator

public VariableIterator iterator()
Returns VariableIterator for the elements.
Specified by:
iterator in interface Netcdf
Returns:
VariableIterator for the elements.
See Also:
VariableIterator

get

public Variable get(java.lang.String name)
Retrieve the variable associated with the specified name.
Specified by:
get in interface Netcdf
Parameters:
name - String which identifies the desired variable
Returns:
the variable, or null if not found

contains

public boolean contains(java.lang.String name)
Tests if the Variable identified by name is in this set.
Specified by:
contains in interface Netcdf
Parameters:
name - String which identifies the desired variable
Returns:
true if and only if this set contains the named variable.

contains

public boolean contains(java.lang.Object oo)
Tests if the argument is in this set.
Specified by:
contains in interface Netcdf
Parameters:
oo - some Object
Returns:
true if and only if this set contains oo

getDimensions

public DimensionSet getDimensions()
Returns the set of dimensions associated with this, the union of those used by each of the variables.
Specified by:
getDimensions in interface Netcdf
Returns:
DimensionSet containing dimensions used by any of the variables. May be empty. Won't be null.

getAttributes

public AttributeSet getAttributes()
Returns the set of attributes associated with this, also know as the "global" attributes.
Specified by:
getAttributes in interface Netcdf
Returns:
AttributeSet. May be empty. Won't be null.

getAttribute

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

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 CDL string of this.

ioFactory

protected abstract Accessor ioFactory(ProtoVariable proto)
                               throws java.lang.reflect.InvocationTargetException
Used when creating variables to populate this. Override in your implementation to provide the correct i/o functionality.

putDimension

protected void putDimension(Dimension dim)
Used for incremental initialization. Add a Dimension to the Netcdf.

putAttribute

protected void putAttribute(Attribute attr)
Used for incremental initialization. Add a (global) attribute to the Netcdf.

add

protected void add(ProtoVariable proto,
                   Accessor io)
            throws java.lang.InstantiationException,
                   java.lang.reflect.InvocationTargetException,
                   java.lang.IllegalAccessException
Used for incremental initialization. Add a variable to the Netcdf.

initHashtable

protected void initHashtable()
                      throws java.lang.InstantiationException,
                             java.lang.reflect.InvocationTargetException,
                             java.lang.IllegalAccessException