public FlowElement getFirstAnchor() { return Util.getFirst( getAnchors() ); }
@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; } }
public Integer getFirstOrdinal() { if( getOrdinals().isEmpty() ) return null; return Util.getFirst( getOrdinals() ); }
public Integer getFirstOrdinal() { if( getOrdinals().isEmpty() ) return null; return Util.getFirst( getOrdinals() ); }
public FlowElementGraph getAssemblyGraph() { Map<ElementGraph, List<? extends ElementGraph>> results = getLevelResults( ProcessLevel.Assembly ); return (FlowElementGraph) Util.getFirst( results.get( getInitialAssembly() ) ); }
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 ); }
@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 ) ); } }
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 ); } }; } }
public Path getIncomingEdge( ElementGraph parent ) { return Util.getFirst( graph.incomingEdgesOf( new Delegate( parent ) ) ); } }
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; } }
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; } }
@Override public void initialize() { super.initialize(); Scope outgoingScope = Util.getFirst( outgoingScopes ); valueEntry = new TupleEntry( outgoingScope.getIncomingFunctionPassThroughFields(), true ); }
@Override public void initialize() { super.initialize(); Scope outgoingScope = Util.getFirst( outgoingScopes ); valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true ); }
@Override public void initialize() { super.initialize(); Scope outgoingScope = Util.getFirst( outgoingScopes ); valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true ); }
@Override public void initialize() { super.initialize(); Scope outgoingScope = Util.getFirst( outgoingScopes ); valueEntry = new TupleEntry( outgoingScope.getIncomingFunctionPassThroughFields(), true ); }
public boolean supportsNonRecursiveMatch() { return allowNonRecursiveMatching && getGraph().vertexSet().size() == 1 && Util.getFirst( getGraph().vertexSet() ).getCapture() == ElementCapture.Primary; }
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(); }
private void initFromNodeConfigDef( final Properties properties ) { initConfFromNodeConfigDef( Util.getFirst( getFlowNodeGraph().vertexSet() ).getElementGraph(), getSetterFor( properties ) ); }
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 ); }
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 ); }