本文整理了Java中ucar.ma2.Array.isConstant()
方法的一些代码示例,展示了Array.isConstant()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.isConstant()
方法的具体详情如下:
包路径:ucar.ma2.Array
类名称:Array
方法名:isConstant
[英]If this is a constant array
[中]如果这是一个常量数组
代码示例来源:origin: Unidata/thredds
/**
* Cover for System.arraycopy(). Works with the underlying data arrays.
* ArraySrc and ArrayDst must be the same primitive type.
* Exposed for efficiency; use at your own risk.
*
* @param arraySrc copy from here : if not in canonical order, an extra copy will be done
* @param srcPos starting at
* @param arrayDst copy to here : must be in canonical order
* @param dstPos starting at
* @param len number of elements to copy
*/
static public void arraycopy(Array arraySrc, int srcPos, Array arrayDst, int dstPos, int len) {
// deal with special case
if (arraySrc.isConstant()) {
double d = arraySrc.getDouble(0);
for (int i = dstPos; i < dstPos + len; i++)
arrayDst.setDouble(i, d);
return;
}
Object src = arraySrc.get1DJavaArray(arraySrc.getDataType()); // ensure canonical order
Object dst = arrayDst.getStorage();
System.arraycopy(src, srcPos, dst, dstPos, len);
}
代码示例来源:origin: edu.ucar/cdm
/**
* Cover for System.arraycopy(). Works with the underlying data arrays.
* ArraySrc and ArrayDst must be the same primitive type.
* Exposed for efficiency; use at your own risk.
*
* @param arraySrc copy from here : if not in canonical order, an extra copy will be done
* @param srcPos starting at
* @param arrayDst copy to here : must be in canonical order
* @param dstPos starting at
* @param len number of elements to copy
*/
static public void arraycopy(Array arraySrc, int srcPos, Array arrayDst, int dstPos, int len) {
// deal with special case
if (arraySrc.isConstant()) {
double d = arraySrc.getDouble(0);
for (int i = dstPos; i < dstPos + len; i++)
arrayDst.setDouble(i, d);
return;
}
Object src = arraySrc.get1DJavaArray(arraySrc.getElementType()); // ensure canonical order
Object dst = arrayDst.getStorage();
System.arraycopy(src, srcPos, dst, dstPos, len);
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Cover for System.arraycopy(). Works with the underlying data arrays.
* ArraySrc and ArrayDst must be the same primitive type.
* Exposed for efficiency; use at your own risk.
*
* @param arraySrc copy from here : if not in canonical order, an extra copy will be done
* @param srcPos starting at
* @param arrayDst copy to here : must be in canonical order
* @param dstPos starting at
* @param len number of elements to copy
*/
static public void arraycopy(Array arraySrc, int srcPos, Array arrayDst, int dstPos, int len) {
// deal with special case
if (arraySrc.isConstant()) {
double d = arraySrc.getDouble(0);
for (int i=dstPos; i<dstPos+len; i++)
arrayDst.setDouble(i, d);
return;
}
Object src = arraySrc.get1DJavaArray(arraySrc.getElementType()); // ensure canonical order
Object dst = arrayDst.getStorage();
try {
System.arraycopy(src, srcPos, dst, dstPos, len);
} catch (ArrayIndexOutOfBoundsException e) {
throw e;
}
}
内容来源于网络,如有侵权,请联系作者删除!