private void iconvertDataPrimitiveArray(PrimitiveVector pv, IndexIterator ii) {
    BaseType bt = pv.getTemplate();

    // set the data value, using scalarIndex from Variable
    if (bt instanceof DString) {
      BaseTypePrimitiveVector bpv = (BaseTypePrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++) {
        DString ds = (DString) bpv.getValue(row);
        ii.setObjectNext( ds.getValue());                     // LOOK CHAR ?
      }

    } else if (bt instanceof DUInt32) {
      UInt32PrimitiveVector bpv = (UInt32PrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++) {
        int ival = bpv.getValue(row);
        long lval = DataType.unsignedIntToLong(ival);        // LOOK unsigned
        ii.setLongNext( lval);
      }
    } else if (bt instanceof DUInt16) {
      UInt16PrimitiveVector bpv = (UInt16PrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++) {
        short sval = bpv.getValue(row);                      // LOOK unsigned
        int ival = DataType.unsignedShortToInt(sval);
        ii.setIntNext (ival);
      }
    } else if (bt instanceof DFloat32) {
      Float32PrimitiveVector bpv = (Float32PrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++)
        ii.setFloatNext (bpv.getValue(row));

    } else if (bt instanceof DFloat64) {
      Float64PrimitiveVector bpv = (Float64PrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++)
        ii.setDoubleNext (bpv.getValue(row));

    } else if (bt instanceof DInt32) {
      Int32PrimitiveVector bpv = (Int32PrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++)
        ii.setIntNext (bpv.getValue(row));

    } else if (bt instanceof DInt16) {
      Int16PrimitiveVector bpv = (Int16PrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++)
        ii.setShortNext (bpv.getValue(row));

    } else if (bt instanceof DByte) {
      BytePrimitiveVector bpv = (BytePrimitiveVector) pv;
      for (int row=0; row < bpv.getLength(); row++)
        ii.setByteNext (bpv.getValue(row));

    } else
      throw new IllegalArgumentException("DODSVariable extractScalar invalid dataType= "+ bt.getClass().getName());
  }
private void iconvertDataPrimitiveArray ( PrimitiveVector pv , IndexIterator ii ) { BaseType bt = pv . getTemplate ( ) ; if ( bt instanceof DString ) { BaseTypePrimitiveVector bpv = ( BaseTypePrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) { DString ds = ( DString ) bpv . getValue ( row ) ; ii . setObjectNext ( ds . getValue ( ) ) ; } } else if ( bt instanceof DUInt32 ) { UInt32PrimitiveVector bpv = ( UInt32PrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) { int ival = bpv . getValue ( row ) ; long lval = DataType . unsignedIntToLong ( ival ) ; ii . setLongNext ( lval ) ; } } else if ( bt instanceof DUInt16 ) { UInt16PrimitiveVector bpv = ( UInt16PrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) { short sval = bpv . getValue ( row ) ; int ival = DataType . unsignedShortToInt ( sval ) ; ii . setIntNext ( ival ) ; } } else if ( bt instanceof DFloat32 ) { Float32PrimitiveVector bpv = ( Float32PrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) ii . setFloatNext ( bpv . getValue ( row ) ) ; } else if ( bt instanceof DFloat64 ) { Float64PrimitiveVector bpv = ( Float64PrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) ii . setDoubleNext ( bpv . getValue ( row ) ) ; } else if ( bt instanceof DInt32 ) { Int32PrimitiveVector bpv = ( Int32PrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) ii . setIntNext ( bpv . getValue ( row ) ) ; } else if ( bt instanceof DInt16 ) { Int16PrimitiveVector bpv = ( Int16PrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) ii . setShortNext ( bpv . getValue ( row ) ) ; } else if ( bt instanceof DByte ) { BytePrimitiveVector bpv = ( BytePrimitiveVector ) pv ; for ( int row = 0 ; row < bpv . getLength ( ) ; row ++ ) ii . setByteNext ( bpv . getValue ( row ) ) ; } else throw new IllegalArgumentException ( "DODSVariable extractScalar invalid dataType= " + bt . getClass ( ) . getName ( ) ) ; }
convert a DODS scalar value