dap4/d4core/src/main/java/dap4/core/util/Slice.java
static public Slice
    compose(Slice target, Slice src)
            throws DapException
    {
        long sr_stride = target.getStride() * src.getStride();
        long sr_first = MAP(target, src.getFirst());
        long lastx = MAP(target, src.getLast());
        long sr_last = (target.getLast() < lastx ? target.getLast() : lastx); //min(last(),lastx)
        return new Slice(sr_first, sr_last + 1, sr_stride, sr_last + 1).finish();
    }
static public Slice
    compose(Slice target, Slice src)
            throws DapException
    {
        long sr_stride = target.getStride() * src.getStride();
        long sr_first = MAP(target, src.getFirst());
        long lastx = MAP(target, src.getLast());
        long sr_last = (target.getLast() < lastx ? target.getLast() : lastx); //min(last(),lastx)
        return new Slice(sr_first, sr_last + 1, sr_stride, sr_last + 1).finish();
    }
static public Slice compose ( Slice target , Slice src ) throws DapException { long sr_stride = target . getStride ( ) * src . getStride ( ) ; long sr_first = MAP ( target , src . getFirst ( ) ) ; long lastx = MAP ( target , src . getLast ( ) ) ; long sr_last = ( target . getLast ( ) < lastx ? target . getLast ( ) : lastx ) ; //min(last(),lastx) return new Slice ( sr_first , sr_last + 1 , sr_stride , sr_last + 1 ) . finish ( ) ; }
Take two slices and compose src wrt target
Assume neither argument is null. This code
should match ucar.ma2.Section in thredds
and dceconstraint.c in the netcdf-c library.

@param target
@param src
@return new, composed Range
@throws DapException
Take two slices and compose src wrt target Assume neither argument is null . This code should match ucar . ma2 . Section in thredds and dceconstraint . c in the netcdf - c library .