## visad.data.netcdf.in
Class VirtualScalar

    java.lang.Object
      visad.data.netcdf.in.VirtualData
          visad.data.netcdf.in.VirtualScalar

Direct Known Subclasses:
  VirtualReal, VirtualText

public abstract class VirtualScalar
extends VirtualData

Provides support for a virtual VisAD Scalar.

Constructor Summary
`VirtualScalar(ScalarType type, Variable var)` Constructs from a scalar type and a 1-D netCDF variable
`VirtualScalar(ScalarType type, Variable var, SimpleSet rangeSet, Unit unit, Vetter vetter)` Constructs from a scalar type, a 1-D netCDF variable, a range set, a unit, and a value vetter.

Method Summary
`DataImpl` `getData(Context context)` Gets the VisAD data object corresponding to this virtual, data object.
`DataFactory` `getDataFactory()` Returns the factory used to create VisAD data objects.
`double[]` `getDoubles(Context context)` Gets the double values corresponding to this virtual, data object at a given context.
`SimpleSet` `getRangeSet()` Gets the range set of this scalar.
`protected abstract Scalar` `getScalar(Context context)` Gets the Scalar object corresponding to this virtual, data object.
`ScalarType` `getScalarType()` Gets the ScalarType of this scalar.
`MathType` `getType()` Gets the MathType of this scalar.
`Unit` `getUnit()` Gets the unit of the value.
`Variable` `getVariable()` Gets the netCDF variable.
`Vetter` `getVetter()` Gets the value vetter.
`boolean` `isReal()` Determines if this is a VirtualReal or not.
`void` `setDataFactory(DataFactory factory)` Sets the factory used to create VisAD data objects.
`(package private) static Object` `toArray(Variable var, double[] values, int[] origin, int[] shape)` Gets data values of a netCDF variable and performs type conversion.

Methods inherited from class visad.data.netcdf.in.VirtualData
`clone, getData, toString`

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

Constructor Detail

### VirtualScalar

    public VirtualScalar(ScalarType type,
                         Variable var,
                         SimpleSet rangeSet,
                         Unit unit,
                         Vetter vetter)

  Constructs from a scalar type, a 1-D netCDF variable, a range set, a unit, and a value vetter.

Parameters:
  `type` - The type of the nested scalar.
  `var` - The 1-D netCDF variable.
  `rangeSet` - The range set of the values.
  `unit` - The unit of the values.
  `vetter` - The value vetter.

### VirtualScalar

    public VirtualScalar(ScalarType type,
                         Variable var)

  Constructs from a scalar type and a 1-D netCDF variable

Parameters:
  `type` - The type of the nested scalar.
  `var` - The 1-D netCDF variable.

Method Detail

### getScalarType

    public ScalarType getScalarType()

  Gets the ScalarType of this scalar.

  Returns:
    The ScalarType of this scalar.

### getType

    public MathType getType()

  Gets the MathType of this scalar.

  Specified by:
    `getType` in class `VirtualData`
  Returns:
    The ScalarType of this scalar.

### isReal

    public boolean isReal()

  Determines if this is a VirtualReal or not.

  Returns:
    true if this is a VirtualReal

### getRangeSet

    public SimpleSet getRangeSet()

  Gets the range set of this scalar.

  Returns:
    The range set of this scalar.
  Throws:
    `RuntimeException` - if class doesn't support this.

### getUnit

    public Unit getUnit()

  Gets the unit of the value.

  Returns:
    The unit of the value.
  Throws:
    `RuntimeException` - if class doesn't support this.

### getVariable

    public Variable getVariable()

  Gets the netCDF variable.

  Returns:
    The netCDF variable.

### getVetter

    public Vetter getVetter()

  Gets the value vetter.

  Returns:
    The value vetter.
  Throws:
    `RuntimeException` - if class doesn't support this.

### getData

    public DataImpl getData(Context context)
                     throws InvalidContextException,
                            VisADException,
                            RemoteException,
                            IOException

  Gets the VisAD data object corresponding to this virtual, data object.

  Specified by:
    `getData` in class `VirtualData`
  Parameters:
    `context` - The context in which the data is to be gotten.
  Returns:
    The VisAD Scalar corresponding to this virtual, data object. throws InvalidContextException Invalid context.
  Throws:
    `InvalidContextException` - if the indicial context is invalid.
    `VisADException` - Couldn't create necessary VisAD object.
    `RemoteException` - if a Java RMI failure occurs.
    `IOException` - I/O failure.

### getScalar

    protected abstract Scalar getScalar(Context context)
                                 throws VisADException,
                                        InvalidContextException,
                                        IOException

  Gets the Scalar object corresponding to this virtual, data object.

  Returns:
    The VisAD Scalar corresponding to this virtual, data object.
  Throws:
    `InvalidContextException` - if the indicial context is invalid.
    `VisADException` - Couldn't create necessary VisAD object.
    `RemoteException` - if a Java RMI failure occurs.
    `IOException` - I/O failure.

### getDoubles

    public double[] getDoubles(Context context)
                        throws IOException,
                               VisADException

  Gets the double values corresponding to this virtual, data object at a given context.

  Returns:
    The double values of this virtual, data object.
  Throws:
    `VisADException` - Couldn't create necessary VisAD object.
    `IOException` - I/O failure.
    `RuntimeException` - if class doesn't support this.

### toArray

    static Object toArray(Variable var,
                          double[] values,
                          int[] origin,
                          int[] shape)
                   throws IOException

  Gets data values of a netCDF variable and performs type conversion.

  Parameters:
    `var` - A netCDF variable.
    `values` - The destination array for the data values. `values.length` must be >= the number of points represented by `shape`.
    `origin` - The origin vector for the values.
    `shape` - The shape of the I/O transfer.
  Returns:
    `values`.
  Throws:
    `IOException` - I/O failure.
  See Also:
    `Variable.toArray(Object, int[], int[])`

### setDataFactory

    public void setDataFactory(DataFactory factory)

  Sets the factory used to create VisAD data objects.

  Specified by:
    `setDataFactory` in class `VirtualData`
  Parameters:
    `factory` - The factory for creating VisAD data objects.

### getDataFactory

    public DataFactory getDataFactory()

  Returns the factory used to create VisAD data objects.

  Specified by:
    `getDataFactory` in class `VirtualData`
  Returns:
    The factory for creating VisAD data objects.