本文整理了Java中cascading.tuple.TupleEntry.<init>()
方法的一些代码示例,展示了TupleEntry.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TupleEntry.<init>()
方法的具体详情如下:
包路径:cascading.tuple.TupleEntry
类名称:TupleEntry
方法名:<init>
[英]Constructor TupleEntry creates a new TupleEntry instance.
[中]构造函数TupleEntry创建一个新的TupleEntry实例。
代码示例来源:origin: cwensel/cascading
public ReceiveMessage( Duct previous, int ordinal, TupleEntry tuple )
{
super( previous );
this.ordinal = ordinal;
// we make a new copy right here, to avoid cross-thread trouble when upstream changes the tuple
this.tuple = new TupleEntry( tuple );
}
代码示例来源:origin: cwensel/cascading
/**
* Constructor TupleEntryIterator creates a new TupleEntryIterator instance.
*
* @param fields of type Fields
*/
public TupleEntryIterator( Fields fields )
{
this.entry = new TupleEntry( fields, Tuple.size( fields.size() ) );
}
代码示例来源:origin: cwensel/cascading
private TupleEntry getEntry( Fields fields, Comparable lhs, Comparable rhs )
{
Tuple parameters = new Tuple( lhs, rhs );
return new TupleEntry( fields, parameters );
}
代码示例来源:origin: cwensel/cascading
@Override
public void initialize()
{
super.initialize();
Scope outgoingScope = Util.getFirst( outgoingScopes );
valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true );
}
代码示例来源:origin: cwensel/cascading
@Override
public void prepare( FlowProcess flowProcess, OperationCall<Pair<SimpleDateFormat, TupleEntry>> operationCall )
{
operationCall.setContext( new Pair<>( getDateFormat(), new TupleEntry( operationCall.getDeclaredFields(), Tuple.size( getDeclaredSize() ) ) ) );
}
代码示例来源:origin: cwensel/cascading
public void setFields( Fields declared )
{
if( declared == null )
throw new IllegalArgumentException( "declared fields must not be null" );
if( declared.isUnknown() || declared.isAll() )
return;
// if operation declared ARGS, then the arguments are a selector and must be forced to declared
declared = Fields.asDeclaration( declared );
this.tupleEntry = new TupleEntry( declared, Tuple.size( declared.size() ), true );
}
代码示例来源:origin: cwensel/cascading
private TupleEntry getEntry( Comparable f, Comparable s, Comparable t )
{
Fields fields = new Fields( "a", "b", "c" );
Tuple parameters = new Tuple( f, s, t );
return new TupleEntry( fields, parameters );
}
}
代码示例来源:origin: cwensel/cascading
private TupleEntry getEntry( Comparable lhs, Comparable rhs )
{
Fields fields = new Fields( "a", "b" );
Tuple parameters = new Tuple( lhs, rhs );
return new TupleEntry( fields, parameters );
}
代码示例来源:origin: cwensel/cascading
@Override
public void prepare( FlowProcess flowProcess, OperationCall<Pair<Matcher, TupleEntry>> operationCall )
{
int size;
if( groups != null )
size = groups.length;
else
size = operationCall.getDeclaredFields().size(); // if Fields.UNKNOWN size will be zero
// TupleEntry allows us to honor the declared field type information
TupleEntry entry = new TupleEntry( operationCall.getDeclaredFields(), Tuple.size( size ) );
operationCall.setContext( new Pair<>( getPattern().matcher( "" ), entry ) );
}
代码示例来源:origin: cwensel/cascading
private TupleEntry getEntry( Comparable lhs, Comparable rhs )
{
Fields fields = new Fields( "a", "b" );
Tuple parameters = new Tuple( lhs, rhs );
return new TupleEntry( fields, parameters );
}
代码示例来源:origin: cwensel/cascading
private TupleEntry getEntry( Comparable lhs, Comparable rhs )
{
Fields fields = new Fields( "a", "b" );
Tuple parameters = new Tuple( lhs, rhs );
return new TupleEntry( fields, parameters );
}
代码示例来源:origin: cwensel/cascading
@Override
public void prepare( FlowProcess flowProcess, OperationCall<Pair<Pattern, TupleEntry>> operationCall )
{
length = operationCall.getDeclaredFields().isUnknown() ? -1 : operationCall.getDeclaredFields().size();
TupleEntry tupleEntry = new TupleEntry( operationCall.getDeclaredFields(), Tuple.size( Math.max( 1, length ) ) );
operationCall.setContext( new Pair<>( getPattern(), tupleEntry ) );
}
代码示例来源:origin: cwensel/cascading
private TupleEntry getEntry( String[] names, Class[] types, Object... values )
{
Fields fields = new Fields( names ).applyTypes( types );
Tuple parameters = new Tuple( values );
return new TupleEntry( fields, parameters );
}
代码示例来源:origin: cwensel/cascading
@Test(expected = TupleException.class)
public void testCoerceCanonicalUnknownFail()
{
Tuple tuple = new Tuple( 1 );
TupleEntry results = new TupleEntry( Fields.UNKNOWN, tuple );
assertEquals( 1, results.getInteger( 1 ) );
}
代码示例来源:origin: cwensel/cascading
@Test
public void testRegexFilter() throws Exception
{
TupleEntry entry = new TupleEntry( new Fields( "json", JSONCoercibleType.TYPE ), Tuple.size( 1 ) );
entry.setObject( 0, JSONData.nested );
assertTrue( invokeFilter( new JSONRegexFilter( "/person/name", Pattern.compile( "John D Doe" ) ), entry ) );
assertTrue( invokeFilter( new JSONRegexFilter( "/person/name", Pattern.compile( "^John$" ) ), entry ) );
assertFalse( invokeFilter( new JSONRegexFilter( "/person/name", Pattern.compile( "^John Doe$" ) ), entry ) );
assertFalse( invokeFilter( new JSONRegexFilter( "/person/name", Pattern.compile( "John Doe" ) ), entry ) );
assertFalse( invokeFilter( new JSONRegexFilter( "/person/name", Pattern.compile( "John[ ]Doe$" ) ), entry ) );
}
}
代码示例来源:origin: cwensel/cascading
@Test
public void testSelectNotComparable()
{
Fields selector = new Fields( 1, "d" );
Object object = new Object();
TupleEntry entryA = new TupleEntry( new Fields( "a", "b" ), new Tuple( "a", object ) );
TupleEntry entryB = new TupleEntry( new Fields( "c", "d" ), new Tuple( "c", "d" ) );
Tuple tuple = TupleEntry.select( selector, entryA, entryB );
assertEquals( "wrong size", 2, tuple.size() );
assertEquals( "not equal: tuple.get(0)", object, tuple.getObject( 0 ) );
assertEquals( "not equal: tuple.get(1)", "d", tuple.getObject( 1 ) );
}
代码示例来源:origin: cwensel/cascading
@Test
public void testSetCanonicalNull()
{
TupleEntry entryA = new TupleEntry( new Fields( "a", "b", "c" ), new Tuple( "a", "b", "c" ) );
entryA.setCanonicalTuple( null );
assertTrue( entryA.getTuple() == null );
}
代码示例来源:origin: cwensel/cascading
@Test
public void testSelect()
{
Fields selector = new Fields( "a", "d" );
TupleEntry entryA = new TupleEntry( new Fields( "a", "b" ), new Tuple( "a", "b" ) );
TupleEntry entryB = new TupleEntry( new Fields( "c", "d" ), new Tuple( "c", "d" ) );
Tuple tuple = TupleEntry.select( selector, entryA, entryB );
assertEquals( "wrong size", 2, tuple.size() );
assertEquals( "not equal: tuple.get(0)", "a", tuple.getObject( 0 ) );
assertEquals( "not equal: tuple.get(1)", "d", tuple.getObject( 1 ) );
}
代码示例来源:origin: cwensel/cascading
@Test
public void testGetMissing() throws Exception
{
TupleEntry entry = new TupleEntry( new Fields( "json", JSONCoercibleType.TYPE ), Tuple.size( 1 ) );
entry.setObject( 0, JSONData.nested );
JSONGetFunction function = new JSONGetFunction( new Fields( "result" ), "/person/foobar" );
TupleListCollector result = invokeFunction( function, entry, new Fields( "result" ) );
Object value = result.iterator().next().getObject( 0 );
assertNull( value );
}
代码示例来源:origin: cwensel/cascading
@Test(expected = OperationException.class)
public void testGetMissingFail() throws Exception
{
TupleEntry entry = new TupleEntry( new Fields( "json", JSONCoercibleType.TYPE ), Tuple.size( 1 ) );
entry.setObject( 0, JSONData.nested );
JSONGetFunction function = new JSONGetFunction( new Fields( "result" ), true, "/person/foobar" );
invokeFunction( function, entry, new Fields( "result" ) );
}
内容来源于网络,如有侵权,请联系作者删除!