## visad.data.netcdf
Class VariableFilter

    java.lang.Object
      ucar.netcdf.NetcdfWrapper
          visad.data.netcdf.VariableFilter

All Implemented Interfaces:
  Netcdf

final class VariableFilter
extends NetcdfWrapper

Wrapper class for restricting the `Netcdf.iterator()` and `Netcdf.size()` methods to only those variables that are also in a client-specified list. All other methods of the `Netcdf` API are those of `NetcdfWrapper`. Thus, it is possible to bypass the variable-filtering provided by this class by directly invoking the single-variable methods (e.g. `Netcdf.get(String)`, `Netcdf.contains(Object)`).

Constructor Summary
`protected` `VariableFilter(Netcdf netcdf, Set names)` Constructs from a netCDF dataset and a set of variable names.

Method Summary
`VariableIterator` `iterator()` Returns an iterator over the variables.
`int` `size()` Returns the number of variables.

Methods inherited from class ucar.netcdf.NetcdfWrapper
`contains, contains, get, getAttribute, getAttributes, getDimensions, getNetcdf`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### VariableFilter

    protected VariableFilter(Netcdf netcdf,
                             Set names)
                      throws NullPointerException

  Constructs from a netCDF dataset and a set of variable names. The dataset will appear to only contain the set of variables that is the intersection of the variables in the dataset and the named variables.

Parameters:
  `netcdf` - The netCDF dataset to be wrapped.
  `names` - A set of variable names.

Method Detail

### size

    public int size()

  Returns the number of variables. This is the number of variables that will be returned by the iterator obtained from the `iterator()` method.

  Specified by:
    `size` in interface `Netcdf`
  Overrides:
    `size` in class `NetcdfWrapper`
  Returns:
    The number of variables

### iterator

    public VariableIterator iterator()

  Returns an iterator over the variables. The iterator will only return those variables in the underlying netCDF dataset whose names were in the set of names used during construction. The number of such variables equals the return value of `size()`.

  Specified by:
    `iterator` in interface `Netcdf`
  Overrides:
    `iterator` in class `NetcdfWrapper`
  Returns:
    An iterator over the variables.