本文整理汇总了Java中ucar.ma2.IndexIterator.setObjectNext方法的典型用法代码示例。如果您正苦于以下问题:Java IndexIterator.setObjectNext方法的具体用法?Java IndexIterator.setObjectNext怎么用?Java IndexIterator.setObjectNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ucar.ma2.IndexIterator
的用法示例。
在下文中一共展示了IndexIterator.setObjectNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSection
import ucar.ma2.IndexIterator; //导入方法依赖的package包/类
/**
* Set section
*
* @param a Array a
* @param ranges Ranges
* @param v Number value
* @return Result array
* @throws InvalidRangeException
*/
public static Array setSection(Array a, List<Range> ranges, Number v) throws InvalidRangeException {
Array r = a.section(ranges);
IndexIterator iter = r.getIndexIterator();
while (iter.hasNext()) {
iter.setObjectNext(v);
}
r = Array.factory(a.getDataType(), a.getShape(), r.getStorage());
return r;
}
示例2: join
import ucar.ma2.IndexIterator; //导入方法依赖的package包/类
/**
* Join two arrays by a dimension
*
* @param a Array a
* @param b Array b
* @param dim Dimension for join
* @return Joined array
*/
public static Array join(Array a, Array b, int dim) {
int[] shape = a.getShape();
int na = shape[dim];
shape[dim] = shape[dim] + b.getShape()[dim];
int n = shape[dim];
Array r = Array.factory(a.getDataType(), shape);
IndexIterator iter = r.getIndexIterator();
IndexIterator itera = a.getIndexIterator();
IndexIterator iterb = b.getIndexIterator();
int[] current;
int i = 0;
while (iter.hasNext()) {
if (i > 0) {
current = iter.getCurrentCounter();
if (current[dim] < na - 1 || current[dim] == n - 1) {
iter.setObjectNext(itera.getObjectNext());
} else {
iter.setObjectNext(iterb.getObjectNext());
}
} else {
iter.setObjectNext(itera.getObjectNext());
}
i += 1;
}
return r;
}
示例3: initArrayWithFillValue
import ucar.ma2.IndexIterator; //导入方法依赖的package包/类
private static void initArrayWithFillValue(Array array, Object fillValue) {
IndexIterator indexIterator = array.getIndexIterator();
while(indexIterator.hasNext()){
indexIterator.setObjectNext(fillValue);;
}
}