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

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

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

Util.getFirst介绍

暂无

代码示例

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

public FlowElement getFirstAnchor()
 {
 return Util.getFirst( getAnchors() );
 }

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

@Override
protected boolean transformGraphInPlaceUsing( Transformed<ElementGraph> transformed, ElementGraph graph, Match match )
 {
 Set<FlowElement> replace = match.getCapturedElements( ElementCapture.Primary );
 Set<FlowElement> replaceWith = match.getCapturedElements( ElementCapture.Secondary );
 if( replace.isEmpty() || replaceWith.isEmpty() )
  return false;
 if( replace.size() != 1 )
  throw new IllegalStateException( "too many captured elements" );
 if( replaceWith.size() != 1 )
  throw new IllegalStateException( "too many target elements" );
 ElementGraphs.replaceElementWith( graph, Util.getFirst( replace ), Util.getFirst( replaceWith ) );
 return true;
 }
}

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

public Integer getFirstOrdinal()
 {
 if( getOrdinals().isEmpty() )
  return null;
 return Util.getFirst( getOrdinals() );
 }

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

public Integer getFirstOrdinal()
 {
 if( getOrdinals().isEmpty() )
  return null;
 return Util.getFirst( getOrdinals() );
 }

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

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

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

public String makeFlowStepName( FlowStep flowStep, int numSteps, int stepNum )
 {
 Tap sink = Util.getFirst( flowStep.getSinkTaps() );
 stepNum++; // number more sensical (5/5)
 if( sink == null || sink.isTemporary() )
  return String.format( "(%d/%d)", stepNum, numSteps );
 String identifier = sink.getIdentifier();
 if( Util.isEmpty( identifier ) )
  return String.format( "(%d/%d)", stepNum, numSteps );
 if( identifier.length() > 25 )
  identifier = String.format( "...%25s", identifier.substring( identifier.length() - 25 ) );
 return String.format( "(%d/%d) %s", stepNum, numSteps, identifier );
 }

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

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

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

protected OutputCollector createOutputCollector()
 {
 if( logicalOutputs.size() == 1 )
  return new OldOutputCollector( Util.getFirst( logicalOutputs ) );
 final OutputCollector[] collectors = new OutputCollector[ logicalOutputs.size() ];
 int count = 0;
 for( LogicalOutput logicalOutput : logicalOutputs )
  collectors[ count++ ] = new OldOutputCollector( logicalOutput );
 return new OutputCollector()
  {
  @Override
  public void collect( Object key, Object value ) throws IOException
   {
   for( OutputCollector outputCollector : collectors )
    outputCollector.collect( key, value );
   }
  };
 }
}

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

public Path getIncomingEdge( ElementGraph parent )
 {
 return Util.getFirst( graph.incomingEdgesOf( new Delegate( parent ) ) );
 }
}

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

private static void walkDown( Set<FlowElement> branch, ElementGraph elementGraph, FlowElement flowElement )
 {
 FlowElement current;
 current = flowElement;
 while( true )
  {
  if( !branch.contains( current ) && ( elementGraph.inDegreeOf( current ) != 1 || elementGraph.outDegreeOf( current ) != 1 ) )
   break;
  branch.add( current );
  FlowElement element = elementGraph.getEdgeTarget( getFirst( elementGraph.outgoingEdgesOf( current ) ) );
  if( element instanceof Extent || branch.contains( element ) )
   break;
  current = element;
  }
 }

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

private static void walkUp( Set<FlowElement> branch, ElementGraph elementGraph, FlowElement flowElement )
 {
 FlowElement current = flowElement;
 while( true )
  {
  if( elementGraph.inDegreeOf( current ) != 1 || elementGraph.outDegreeOf( current ) != 1 )
   break;
  branch.add( current );
  FlowElement element = elementGraph.getEdgeSource( getFirst( elementGraph.incomingEdgesOf( current ) ) );
  if( element instanceof Extent || branch.contains( element ) )
   break;
  current = element;
  }
 }

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

@Override
public void initialize()
 {
 super.initialize();
 Scope outgoingScope = Util.getFirst( outgoingScopes );
 valueEntry = new TupleEntry( outgoingScope.getIncomingFunctionPassThroughFields(), true );
 }

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

@Override
public void initialize()
 {
 super.initialize();
 Scope outgoingScope = Util.getFirst( outgoingScopes );
 valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true );
 }

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

@Override
public void initialize()
 {
 super.initialize();
 Scope outgoingScope = Util.getFirst( outgoingScopes );
 valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true );
 }

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

@Override
public void initialize()
 {
 super.initialize();
 Scope outgoingScope = Util.getFirst( outgoingScopes );
 valueEntry = new TupleEntry( outgoingScope.getIncomingFunctionPassThroughFields(), true );
 }

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

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

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

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

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

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

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

protected void buildGraph()
 {
 Group group = (Group) Util.getFirst( node.getSourceElements() );
 Duct rhsDuct;
 if( group.isGroupBy() )
  rhsDuct = new HadoopGroupByGate( flowProcess, (GroupBy) group, IORole.source );
 else
  rhsDuct = new HadoopCoGroupGate( flowProcess, (CoGroup) group, IORole.source );
 addHead( rhsDuct );
 handleDuct( group, rhsDuct );
 }

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

protected void buildGraph()
 {
 Group group = (Group) Util.getFirst( node.getSourceElements() );
 Duct rhsDuct;
 if( group.isGroupBy() )
  rhsDuct = new HadoopGroupByGate( flowProcess, (GroupBy) group, IORole.source );
 else
  rhsDuct = new HadoopCoGroupGate( flowProcess, (CoGroup) group, IORole.source );
 addHead( rhsDuct );
 handleDuct( group, rhsDuct );
 }

相关文章