cascading.util.Util.getFirst()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(197)

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

Util.getFirst介绍

暂无

代码示例

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

  1. public FlowElement getFirstAnchor()
  2. {
  3. return Util.getFirst( getAnchors() );
  4. }

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

  1. @Override
  2. protected boolean transformGraphInPlaceUsing( Transformed<ElementGraph> transformed, ElementGraph graph, Match match )
  3. {
  4. Set<FlowElement> replace = match.getCapturedElements( ElementCapture.Primary );
  5. Set<FlowElement> replaceWith = match.getCapturedElements( ElementCapture.Secondary );
  6. if( replace.isEmpty() || replaceWith.isEmpty() )
  7. return false;
  8. if( replace.size() != 1 )
  9. throw new IllegalStateException( "too many captured elements" );
  10. if( replaceWith.size() != 1 )
  11. throw new IllegalStateException( "too many target elements" );
  12. ElementGraphs.replaceElementWith( graph, Util.getFirst( replace ), Util.getFirst( replaceWith ) );
  13. return true;
  14. }
  15. }

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

  1. public Integer getFirstOrdinal()
  2. {
  3. if( getOrdinals().isEmpty() )
  4. return null;
  5. return Util.getFirst( getOrdinals() );
  6. }

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

  1. public Integer getFirstOrdinal()
  2. {
  3. if( getOrdinals().isEmpty() )
  4. return null;
  5. return Util.getFirst( getOrdinals() );
  6. }

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

  1. public FlowElementGraph getAssemblyGraph()
  2. {
  3. Map<ElementGraph, List<? extends ElementGraph>> results = getLevelResults( ProcessLevel.Assembly );
  4. return (FlowElementGraph) Util.getFirst( results.get( getInitialAssembly() ) );
  5. }

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

  1. public String makeFlowStepName( FlowStep flowStep, int numSteps, int stepNum )
  2. {
  3. Tap sink = Util.getFirst( flowStep.getSinkTaps() );
  4. stepNum++; // number more sensical (5/5)
  5. if( sink == null || sink.isTemporary() )
  6. return String.format( "(%d/%d)", stepNum, numSteps );
  7. String identifier = sink.getIdentifier();
  8. if( Util.isEmpty( identifier ) )
  9. return String.format( "(%d/%d)", stepNum, numSteps );
  10. if( identifier.length() > 25 )
  11. identifier = String.format( "...%25s", identifier.substring( identifier.length() - 25 ) );
  12. return String.format( "(%d/%d) %s", stepNum, numSteps, identifier );
  13. }

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

  1. @Override
  2. public Path createEdge( Delegate sourceVertex, Delegate targetVertex )
  3. {
  4. Set<Path> paths = tree.graph.incomingEdgesOf( sourceVertex );
  5. if( paths.size() > 1 )
  6. throw new IllegalStateException( "too many incoming edges" );
  7. Path path = Util.getFirst( paths );
  8. return new Path( path, tree.graph.outDegreeOf( sourceVertex ) );
  9. }
  10. }

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

  1. protected OutputCollector createOutputCollector()
  2. {
  3. if( logicalOutputs.size() == 1 )
  4. return new OldOutputCollector( Util.getFirst( logicalOutputs ) );
  5. final OutputCollector[] collectors = new OutputCollector[ logicalOutputs.size() ];
  6. int count = 0;
  7. for( LogicalOutput logicalOutput : logicalOutputs )
  8. collectors[ count++ ] = new OldOutputCollector( logicalOutput );
  9. return new OutputCollector()
  10. {
  11. @Override
  12. public void collect( Object key, Object value ) throws IOException
  13. {
  14. for( OutputCollector outputCollector : collectors )
  15. outputCollector.collect( key, value );
  16. }
  17. };
  18. }
  19. }

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

  1. public Path getIncomingEdge( ElementGraph parent )
  2. {
  3. return Util.getFirst( graph.incomingEdgesOf( new Delegate( parent ) ) );
  4. }
  5. }

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

  1. private static void walkDown( Set<FlowElement> branch, ElementGraph elementGraph, FlowElement flowElement )
  2. {
  3. FlowElement current;
  4. current = flowElement;
  5. while( true )
  6. {
  7. if( !branch.contains( current ) && ( elementGraph.inDegreeOf( current ) != 1 || elementGraph.outDegreeOf( current ) != 1 ) )
  8. break;
  9. branch.add( current );
  10. FlowElement element = elementGraph.getEdgeTarget( getFirst( elementGraph.outgoingEdgesOf( current ) ) );
  11. if( element instanceof Extent || branch.contains( element ) )
  12. break;
  13. current = element;
  14. }
  15. }

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

  1. private static void walkUp( Set<FlowElement> branch, ElementGraph elementGraph, FlowElement flowElement )
  2. {
  3. FlowElement current = flowElement;
  4. while( true )
  5. {
  6. if( elementGraph.inDegreeOf( current ) != 1 || elementGraph.outDegreeOf( current ) != 1 )
  7. break;
  8. branch.add( current );
  9. FlowElement element = elementGraph.getEdgeSource( getFirst( elementGraph.incomingEdgesOf( current ) ) );
  10. if( element instanceof Extent || branch.contains( element ) )
  11. break;
  12. current = element;
  13. }
  14. }

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

  1. @Override
  2. public void initialize()
  3. {
  4. super.initialize();
  5. Scope outgoingScope = Util.getFirst( outgoingScopes );
  6. valueEntry = new TupleEntry( outgoingScope.getIncomingFunctionPassThroughFields(), true );
  7. }

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

  1. @Override
  2. public void initialize()
  3. {
  4. super.initialize();
  5. Scope outgoingScope = Util.getFirst( outgoingScopes );
  6. valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true );
  7. }

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

  1. @Override
  2. public void initialize()
  3. {
  4. super.initialize();
  5. Scope outgoingScope = Util.getFirst( outgoingScopes );
  6. valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true );
  7. }

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

  1. @Override
  2. public void initialize()
  3. {
  4. super.initialize();
  5. Scope outgoingScope = Util.getFirst( outgoingScopes );
  6. valueEntry = new TupleEntry( outgoingScope.getIncomingFunctionPassThroughFields(), true );
  7. }

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

  1. public boolean supportsNonRecursiveMatch()
  2. {
  3. return allowNonRecursiveMatching &&
  4. getGraph().vertexSet().size() == 1 &&
  5. Util.getFirst( getGraph().vertexSet() ).getCapture() == ElementCapture.Primary;
  6. }

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

  1. public LocalStepRunner( FlowProcess<Properties> flowProcess, LocalFlowStep step )
  2. {
  3. this.currentProcess = flowProcess;
  4. this.flowNode = Util.getFirst( step.getFlowNodeGraph().vertexSet() );
  5. this.streamGraph = new LocalStepStreamGraph( this.currentProcess, step, flowNode );
  6. this.heads = streamGraph.getHeads();
  7. }

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

  1. private void initFromNodeConfigDef( final Properties properties )
  2. {
  3. initConfFromNodeConfigDef( Util.getFirst( getFlowNodeGraph().vertexSet() ).getElementGraph(), getSetterFor( properties ) );
  4. }

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

  1. protected void buildGraph()
  2. {
  3. Group group = (Group) Util.getFirst( node.getSourceElements() );
  4. Duct rhsDuct;
  5. if( group.isGroupBy() )
  6. rhsDuct = new HadoopGroupByGate( flowProcess, (GroupBy) group, IORole.source );
  7. else
  8. rhsDuct = new HadoopCoGroupGate( flowProcess, (CoGroup) group, IORole.source );
  9. addHead( rhsDuct );
  10. handleDuct( group, rhsDuct );
  11. }

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

  1. protected void buildGraph()
  2. {
  3. Group group = (Group) Util.getFirst( node.getSourceElements() );
  4. Duct rhsDuct;
  5. if( group.isGroupBy() )
  6. rhsDuct = new HadoopGroupByGate( flowProcess, (GroupBy) group, IORole.source );
  7. else
  8. rhsDuct = new HadoopCoGroupGate( flowProcess, (CoGroup) group, IORole.source );
  9. addHead( rhsDuct );
  10. handleDuct( group, rhsDuct );
  11. }

相关文章