本文整理汇总了Java中cascading.tuple.Tuple.set方法的典型用法代码示例。如果您正苦于以下问题:Java Tuple.set方法的具体用法?Java Tuple.set怎么用?Java Tuple.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cascading.tuple.Tuple
的用法示例。
在下文中一共展示了Tuple.set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copy
import cascading.tuple.Tuple; //导入方法依赖的package包/类
@Override
public Tuple copy(Tuple from) {
Tuple target = Tuple.size(from.size());
for (int i = 0; i < from.size(); i++) {
try {
Object orig = from.getObject(i);
if (orig != null) {
target.set(i, fieldSers[i].copy(orig));
}
else {
target.set(i, null);
}
}
catch(ClassCastException cce) {
throw new FlowException("Unexpected type of field \""+fields.get(i)+"\" encountered. " +
"Should have been "+fields.getType(i)+" but was "+from.getObject(i).getClass()+".", cce);
}
}
return target;
}
示例2: deserialize
import cascading.tuple.Tuple; //导入方法依赖的package包/类
@Override
public Tuple deserialize(DataInputView source) throws IOException {
// read null mask
NullMaskSerDeUtils.readNullMask(this.nullFields, this.length, source);
// read non-null fields
Tuple tuple = Tuple.size(this.length);
for (int i = 0; i < this.length; i++) {
Object field;
if(!this.nullFields[i]) {
field = fieldSers[i].deserialize(source);
}
else {
field = null;
}
tuple.set(i, field);
}
return tuple;
}
示例3: deserialize
import cascading.tuple.Tuple; //导入方法依赖的package包/类
@Override
public Tuple deserialize(DataInputView source) throws IOException {
// read length
int arity = source.readInt();
// initialize or resize null fields if necessary
if(this.nullFields == null || this.nullFields.length < arity) {
this.nullFields = new boolean[arity];
}
// read null mask
NullMaskSerDeUtils.readNullMask(this.nullFields, arity, source);
// read non-null fields
Tuple tuple = Tuple.size(arity);
for (int i = 0; i < arity; i++) {
Object field;
if(!this.nullFields[i]) {
field = fieldSer.deserialize(source);
}
else {
field = null;
}
tuple.set(i, field);
}
return tuple;
}