opendap/src/main/java/ucar/nc2/dods/ConvertD2N.java
private void iconvertDataPrimitiveScalar(BaseType dodsScalar, IndexIterator ii) {
    if (dodsScalar instanceof DString) {
      String sval = ((DString) dodsScalar).getValue();
      ii.setObjectNext(sval);

    } else if (dodsScalar instanceof DUInt32) {
      int ival = ((DUInt32) dodsScalar).getValue();
      long lval = DataType.unsignedIntToLong(ival);        // LOOK unsigned
      ii.setLongNext( lval);

    } else if (dodsScalar instanceof DUInt16) {
      short sval = ((DUInt16) dodsScalar).getValue();     // LOOK unsigned
      int ival = DataType.unsignedShortToInt(sval);
      ii.setIntNext (ival);

    } else if (dodsScalar instanceof DFloat32)
      ii.setFloatNext( ((DFloat32) dodsScalar).getValue());
    else if (dodsScalar instanceof DFloat64)
      ii.setDoubleNext( ((DFloat64) dodsScalar).getValue());
    else if (dodsScalar instanceof DInt32)
      ii.setIntNext( ((DInt32) dodsScalar).getValue());
    else if (dodsScalar instanceof DInt16)
      ii.setShortNext( ((DInt16) dodsScalar).getValue());
    else if (dodsScalar instanceof DByte)
      ii.setByteNext( ((DByte) dodsScalar).getValue());
    else
      throw new IllegalArgumentException("DODSVariable extractScalar invalid dataType= " + dodsScalar.getClass().getName());
  }
private void iconvertDataPrimitiveScalar(BaseType dodsScalar, IndexIterator ii) {
    if (dodsScalar instanceof DString) {
      String sval = ((DString) dodsScalar).getValue();
      ii.setObjectNext(sval);

    } else if (dodsScalar instanceof DUInt32) {
      int ival = ((DUInt32) dodsScalar).getValue();
      long lval = DataType.unsignedIntToLong(ival);        // LOOK unsigned
      ii.setLongNext( lval);

    } else if (dodsScalar instanceof DUInt16) {
      short sval = ((DUInt16) dodsScalar).getValue();     // LOOK unsigned
      int ival = DataType.unsignedShortToInt(sval);
      ii.setIntNext (ival);

    } else if (dodsScalar instanceof DFloat32)
      ii.setFloatNext( ((DFloat32) dodsScalar).getValue());
    else if (dodsScalar instanceof DFloat64)
      ii.setDoubleNext( ((DFloat64) dodsScalar).getValue());
    else if (dodsScalar instanceof DInt32)
      ii.setIntNext( ((DInt32) dodsScalar).getValue());
    else if (dodsScalar instanceof DInt16)
      ii.setShortNext( ((DInt16) dodsScalar).getValue());
    else if (dodsScalar instanceof DByte)
      ii.setByteNext( ((DByte) dodsScalar).getValue());
    else
      throw new IllegalArgumentException("DODSVariable extractScalar invalid dataType= " + dodsScalar.getClass().getName());
  }
private void iconvertDataPrimitiveScalar ( BaseType dodsScalar , IndexIterator ii ) { if ( dodsScalar instanceof DString ) { String sval = ( ( DString ) dodsScalar ) . getValue ( ) ; ii . setObjectNext ( sval ) ; } else if ( dodsScalar instanceof DUInt32 ) { int ival = ( ( DUInt32 ) dodsScalar ) . getValue ( ) ; long lval = DataType . unsignedIntToLong ( ival ) ; // LOOK unsigned
 ii . setLongNext ( lval ) ; } else if ( dodsScalar instanceof DUInt16 ) { short sval = ( ( DUInt16 ) dodsScalar ) . getValue ( ) ; // LOOK unsigned
 int ival = DataType . unsignedShortToInt ( sval ) ; ii . setIntNext ( ival ) ; } else if ( dodsScalar instanceof DFloat32 ) ii . setFloatNext ( ( ( DFloat32 ) dodsScalar ) . getValue ( ) ) ; else if ( dodsScalar instanceof DFloat64 ) ii . setDoubleNext ( ( ( DFloat64 ) dodsScalar ) . getValue ( ) ) ; else if ( dodsScalar instanceof DInt32 ) ii . setIntNext ( ( ( DInt32 ) dodsScalar ) . getValue ( ) ) ; else if ( dodsScalar instanceof DInt16 ) ii . setShortNext ( ( ( DInt16 ) dodsScalar ) . getValue ( ) ) ; else if ( dodsScalar instanceof DByte ) ii . setByteNext ( ( ( DByte ) dodsScalar ) . getValue ( ) ) ; else throw new IllegalArgumentException ( "DODSVariable extractScalar invalid dataType= " + dodsScalar . getClass ( ) . getName ( ) ) ; }
convert a DODS scalar value
convert a DODS scalar value