cascading.pipe.Pipe.getName()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中cascading.pipe.Pipe.getName()方法的一些代码示例,展示了Pipe.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Pipe.getName()方法的具体详情如下:
包路径:cascading.pipe.Pipe
类名称:Pipe
方法名:getName

Pipe.getName介绍

[英]Get the name of this pipe. Guaranteed non-null.
[中]知道这根管子的名字。保证非空。

代码示例

代码示例来源:origin: cascading/cascading-bind

private String[] makeNames( Pipe[] pipes )
 {
 String[] names = new String[ pipes.length ];
 for( int i = 0; i < pipes.length; i++ )
  names[ i ] = pipes[ i ].getName();
 return names;
 }

代码示例来源:origin: cwensel/cascading

private void addGroupFields( Pipe pipe, Fields fields )
 {
 if( keyFieldsMap.containsKey( pipe.getName() ) )
  throw new IllegalArgumentException( "each input pipe branch must be uniquely named" );
 keyFieldsMap.put( pipe.getName(), fields );
 }

代码示例来源:origin: cwensel/cascading

@Override
public String toString()
 {
 return getClass().getSimpleName() + "(" + getName() + ")";
 }

代码示例来源:origin: cwensel/cascading

public synchronized Map<String, Integer> getPipePos()
 {
 if( pipePos != null )
  return pipePos;
 pipePos = new HashMap<String, Integer>();
 int pos = 0;
 for( Object pipe : pipes )
  pipePos.put( ( (Pipe) pipe ).getName(), pos++ );
 return pipePos;
 }

代码示例来源:origin: cwensel/cascading

private void addPipe( Pipe pipe )
 {
 if( pipe.getName() == null )
  throw new IllegalArgumentException( "each input pipe must have a name" );
 pipes.add( pipe ); // allow same pipe
 }

代码示例来源:origin: cwensel/cascading

@Override
public int hashCode()
 {
 return 31 * getName().hashCode() + getClass().hashCode();
 }

代码示例来源:origin: cwensel/cascading

private static Pipe find( String name, Iterator<FlowElement> iterator )
 {
 while( iterator.hasNext() )
  {
  FlowElement flowElement = iterator.next();
  if( flowElement instanceof Pipe && ( (Pipe) flowElement ).getName().equals( name ) )
   return (Pipe) flowElement;
  }
 return null;
 }

代码示例来源:origin: cascading/lingual-core

private String makeName( CascadingRelNode node, Pipe pipe )
 {
 String name = "";
 if( node != null )
  name = node.getClass().getSimpleName() + ":";
 name += pipe.getClass().getSimpleName() + "[" + pipe.getName() + "]";
 return name;
 }

代码示例来源:origin: cwensel/cascading

protected void printInternal( StringBuffer buffer, Scope scope )
 {
 buffer.append( getClass().getSimpleName() ).append( "('" ).append( getName() ).append( "')" );
 }
}

代码示例来源:origin: cwensel/cascading

private String makeName( Pipe[] pipes )
 {
 String[] names = new String[ pipes.length ];
 for( int i = 0; i < pipes.length; i++ )
  names[ i ] = pipes[ i ].getName();
 String name = Util.join( names, "+" );
 if( name.length() > 32 )
  name = name.substring( 0, 32 );
 return name;
 }
}

代码示例来源:origin: cwensel/cascading

/**
 * Method addTrap adds a new trap {@link Tap} named after the given {@link Pipe} for use in the resulting {@link Flow}.
 *
 * @param pipe of Pipe
 * @param trap of Tap
 * @return FlowDef
 */
public FlowDef addTrap( Pipe pipe, Tap trap )
 {
 addTrap( pipe.getName(), trap );
 return this;
 }

代码示例来源:origin: cwensel/cascading

@Override
public String format( String trace )
 {
 return "[" + Util.truncate( pipe.getName(), 25 ) + "][" + trace + "]";
 }
} );

代码示例来源:origin: cwensel/cascading

/**
 * Method addSink adds a new sink {@link Tap} named after the given {@link Pipe} for use in the resulting {@link Flow}.
 *
 * @param tail of Pipe
 * @param sink of Tap
 * @return FlowDef
 */
public FlowDef addSink( Pipe tail, Tap sink )
 {
 addSink( tail.getName(), sink );
 return this;
 }

代码示例来源:origin: LiveRamp/cascading_ext

public Map<String, Pipe> getTailsByName(){
 Map<String, Pipe> tails = Maps.newHashMap();
 for (Pipe pipe : getTails()) {
  tails.put(pipe.getName(), pipe);
 }
 return tails;
}

代码示例来源:origin: cwensel/cascading

private List<Fields> getOrderedResolvedFields( Set<Scope> incomingScopes )
 {
 Map<String, Scope> scopesMap = new HashMap<String, Scope>();
 for( Scope incomingScope : incomingScopes )
  scopesMap.put( incomingScope.getName(), incomingScope );
 List<Fields> appendableFields = new ArrayList<Fields>();
 for( Pipe pipe : pipes )
  appendableFields.add( scopesMap.get( pipe.getName() ).getIncomingSpliceFields() );
 return appendableFields;
 }

代码示例来源:origin: cwensel/cascading

@Override
public boolean containsPipeNamed( String pipeName )
 {
 Set<FlowElement> vertices = getElementGraph().vertexSet();
 for( FlowElement vertex : vertices )
  {
  if( vertex instanceof Pipe && ( (Pipe) vertex ).getName().equals( pipeName ) )
   return true;
  }
 return false;
 }

代码示例来源:origin: cwensel/cascading

private static void collectPipes( String name, Pipe[] tails, Set<Pipe> pipes )
 {
 for( Pipe tail : tails )
  {
  if( !( tail instanceof SubAssembly ) && tail.getName().equals( name ) )
   pipes.add( tail );
  collectPipes( name, SubAssembly.unwind( tail.getPrevious() ), pipes );
  }
 }

代码示例来源:origin: cwensel/cascading

private static void collectNames( Pipe[] pipes, Set<String> names )
 {
 for( Pipe pipe : pipes )
  {
  if( pipe instanceof SubAssembly )
   names.addAll( asList( ( (SubAssembly) pipe ).getTailNames() ) );
  else
   names.add( pipe.getName() );
  collectNames( SubAssembly.unwind( pipe.getPrevious() ), names );
  }
 }

代码示例来源:origin: cascading/cascading-hadoop2-mr1

@Test
public void testName()
 {
 Pipe count = new Pipe( "count" );
 Pipe pipe = new GroupBy( count, new Fields( 1 ) );
 pipe = new Every( pipe, new Fields( 1 ), new Count(), new Fields( 0, 1 ) );
 assertEquals( "not equal: count.getName()", "count", count.getName() );
 assertEquals( "not equal: pipe.getName()", "count", pipe.getName() );
 pipe = new Each( count, new Fields( 1 ), new RegexSplitter( Fields.size( 2 ) ) );
 assertEquals( "not equal: pipe.getName()", "count", pipe.getName() );
 }

代码示例来源:origin: cwensel/cascading

@Test
public void testName()
 {
 Pipe count = new Pipe( "count" );
 Pipe pipe = new GroupBy( count, new Fields( 1 ) );
 pipe = new Every( pipe, new Fields( 1 ), new Count(), new Fields( 0, 1 ) );
 assertEquals( "not equal: count.getName()", "count", count.getName() );
 assertEquals( "not equal: pipe.getName()", "count", pipe.getName() );
 pipe = new Each( count, new Fields( 1 ), new RegexSplitter( Fields.size( 2 ) ) );
 assertEquals( "not equal: pipe.getName()", "count", pipe.getName() );
 }

相关文章