当前位置: 首页>>代码示例>>Java>>正文


Java Tuple.set方法代码示例

本文整理汇总了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;
}
 
开发者ID:dataArtisans,项目名称:cascading-flink,代码行数:21,代码来源:DefinedTupleSerializer.java

示例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;
}
 
开发者ID:dataArtisans,项目名称:cascading-flink,代码行数:22,代码来源:DefinedTupleSerializer.java

示例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;
}
 
开发者ID:dataArtisans,项目名称:cascading-flink,代码行数:30,代码来源:UnknownTupleSerializer.java


注:本文中的cascading.tuple.Tuple.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。