/** * Create a buffer for the entire given shared double array. The returned buffer encompasses all * the elements in <TT>theArray</TT>. * * @param theArray Array. * @return Buffer. * @exception NullPointerException (unchecked exception) Thrown if <TT>theArray</TT> is null. */ public static DoubleBuf buffer(SharedDoubleArray theArray) { if (theArray == null) { throw new NullPointerException("DoubleBuf.buffer(): theArray is null"); } int nr = theArray.length(); return new SharedDoubleArrayBuf_1(theArray, new Range(0, nr - 1)); }
/** * Create a buffer for one slice of the given shared double array. The returned buffer encompasses * <TT>theRange</TT> of elements in <TT>theArray</TT>. The range's stride may be 1 or greater than * 1. * * @param theArray Array. * @param theRange Range of elements to include. * @return Buffer. * @exception NullPointerException (unchecked exception) Thrown if <TT>theArray</TT> is null or * <TT>theRange</TT> is null. * @exception IndexOutOfBoundsException (unchecked exception) Thrown if <TT>theArray</TT> does not * include all the indexes in <TT>theRange</TT>. */ public static DoubleBuf sliceBuffer(SharedDoubleArray theArray, Range theRange) { if (theArray == null) { throw new NullPointerException("DoubleBuf.sliceBuffer(): theArray is null"); } int nr = theArray.length(); if (0 > theRange.lb() || theRange.ub() >= nr) { throw new IndexOutOfBoundsException( "DoubleBuf.sliceBuffer(): theArray index range = 0.." + (nr - 1) + ", theRange = " + theRange); } if (theRange.stride() == 1) { return new SharedDoubleArrayBuf_1(theArray, theRange); } else { return new SharedDoubleArrayBuf(theArray, theRange); } }