dap4/d4cdm/src/main/java/dap4/cdm/CDMUtil.java
static public double
    extractDoubleValue(TypeSort atomtype, DataCursor dataset, Index index)
            throws DapException
    {
        Object result;
        result = dataset.read(index);
        double dvalue = 0.0;
        if(atomtype.isIntegerType() || atomtype.isEnumType()) {
            long lvalue = extractLongValue(atomtype, dataset, index);
            dvalue = (double) lvalue;
        } else if(atomtype == TypeSort.Float32) {
            dvalue = (double) ((Float) result).floatValue();
        } else if(atomtype == TypeSort.Float64) {
            dvalue = ((Double) result).doubleValue();
        } else
            throw new ForbiddenConversionException();
        return dvalue;
    }
static public double
    extractDoubleValue(TypeSort atomtype, DataCursor dataset, Index index)
            throws DapException
    {
        Object result;
        result = dataset.read(index);
        double dvalue = 0.0;
        if(atomtype.isIntegerType() || atomtype.isEnumType()) {
            long lvalue = extractLongValue(atomtype, dataset, index);
            dvalue = (double) lvalue;
        } else if(atomtype == TypeSort.Float32) {
            dvalue = (double) ((Float) result).floatValue();
        } else if(atomtype == TypeSort.Float64) {
            dvalue = ((Double) result).doubleValue();
        } else
            throw new ForbiddenConversionException();
        return dvalue;
    }
static public double extractDoubleValue ( TypeSort atomtype , DataCursor dataset , Index index ) throws DapException { Object result ; result = dataset . read ( index ) ; double dvalue = 0.0 ; if ( atomtype . isIntegerType ( ) || atomtype . isEnumType ( ) ) { long lvalue = extractLongValue ( atomtype , dataset , index ) ; dvalue = ( double ) lvalue ; } else if ( atomtype == TypeSort . Float32 ) { dvalue = ( double ) ( ( Float ) result ) . floatValue ( ) ; } else if ( atomtype == TypeSort . Float64 ) { dvalue = ( ( Double ) result ) . doubleValue ( ) ; } else throw new ForbiddenConversionException ( ) ; return dvalue ; }
Extract, as a double, value from a (presumably)
atomic typed array of values; dataset position
is presumed correct.

@param atomtype type of object to extract
@param dataset  Data containing the objects
@param index    Which element of dataset to read
@return resulting value as a double
@throws ForbiddenConversionException if cannot convert to double
Extract as a double value from a ( presumably ) atomic typed array of values ; dataset position is presumed correct .