@Test public void testLeftMostRegions7 () { final List<RegionDef> leftMost = getLeftMostRegions( flow, regions, singletonList( statelessRegion ) ); assertThat( leftMost, equalTo( singletonList( statelessRegion ) ) ); }
public static List<RegionDef> getLeftMostRegions ( final FlowDef flowDef, final List<RegionDef> allRegions, final List<RegionDef> regionsToFilter ) { final List<RegionDef> leftMostRegions = new ArrayList<>( regionsToFilter ); final Function<RegionDef, List<RegionDef>> getWholeDownstreamFunc = r -> getWholeDownstream( flowDef, allRegions, r ); regionsToFilter.stream().map( getWholeDownstreamFunc ).flatMap( List::stream ).forEach( leftMostRegions::remove ); return unmodifiableList( leftMostRegions ); }
RegionUtil { public static List<RegionDef> getLeftMostRegions ( final FlowDef flowDef, final List<RegionDef> allRegions, final List<RegionDef> regionsToFilter ) { final List<RegionDef> leftMostRegions = new ArrayList<>( regionsToFilter ); final Function<RegionDef, List<RegionDef>> getWholeDownstreamFunc = r -> getWholeDownstream( flowDef, allRegions, r ); regionsToFilter.stream().map( getWholeDownstreamFunc ).flatMap( List::stream ).forEach( leftMostRegions::remove ); return unmodifiableList( leftMostRegions ); } }
RegionUtil { public static List<RegionDef> getLeftMostRegions ( final FlowDef flowDef, final List<RegionDef> allRegions, final List<RegionDef> regionsToFilter ) { final List<RegionDef> leftMostRegions = new ArrayList<>( regionsToFilter ); final Function<RegionDef, List<RegionDef>> getWholeDownstreamFunc = r -> getWholeDownstream( flowDef, allRegions, r ); regionsToFilter.stream().map( getWholeDownstreamFunc ).flatMap( List::stream ).forEach( leftMostRegions::remove ); return unmodifiableList( leftMostRegions ); }  }
RegionUtil { public static List<RegionDef> getLeftMostRegions ( final FlowDef flowDef, final List<RegionDef> allRegions, final List<RegionDef> regionsToFilter ) { final List<RegionDef> leftMostRegions = new ArrayList<>( regionsToFilter ); final Function<RegionDef, List<RegionDef>> getWholeDownstreamFunc = r -> getWholeDownstream( flowDef, allRegions, r ); regionsToFilter.stream().map( getWholeDownstreamFunc ).flatMap( List::stream ).forEach( leftMostRegions::remove ); return unmodifiableList( leftMostRegions ); }  static List<RegionDef> sortTopologically( final Map<String, OperatorDef> operators,
                                                      final Collection<Entry<Port, Port>> connections,
                                                      final List<RegionDef> regions ); static RegionDef getRegionByLastOperator( final List<RegionDef> regions, final OperatorDef operator ); static RegionDef getRegionByFirstOperator( final List<RegionDef> regions, final String operatorId ); static OperatorDef getFirstOperator( final RegionDef regionDef ); static OperatorDef getLastOperator( final RegionDef regionDef ); static List<RegionDef> getWholeDownstream( final FlowDef flowDef, final List<RegionDef> regions, final RegionDef upstream ); static List<RegionDef> getLeftMostRegions( final FlowDef flowDef,
                                                       final List<RegionDef> allRegions,
                                                       final List<RegionDef> regionsToFilter ); }
RegionUtil { public static List<RegionDef> getLeftMostRegions ( final FlowDef flowDef, final List<RegionDef> allRegions, final List<RegionDef> regionsToFilter ) { final List<RegionDef> leftMostRegions = new ArrayList<>( regionsToFilter ); final Function<RegionDef, List<RegionDef>> getWholeDownstreamFunc = r -> getWholeDownstream( flowDef, allRegions, r ); regionsToFilter.stream().map( getWholeDownstreamFunc ).flatMap( List::stream ).forEach( leftMostRegions::remove ); return unmodifiableList( leftMostRegions ); }  static List<RegionDef> sortTopologically( final Map<String, OperatorDef> operators,
                                                      final Collection<Entry<Port, Port>> connections,
                                                      final List<RegionDef> regions ); static RegionDef getRegionByLastOperator( final List<RegionDef> regions, final OperatorDef operator ); static RegionDef getRegionByFirstOperator( final List<RegionDef> regions, final String operatorId ); static OperatorDef getFirstOperator( final RegionDef regionDef ); static OperatorDef getLastOperator( final RegionDef regionDef ); static List<RegionDef> getWholeDownstream( final FlowDef flowDef, final List<RegionDef> regions, final RegionDef upstream ); static List<RegionDef> getLeftMostRegions( final FlowDef flowDef,
                                                       final List<RegionDef> allRegions,
                                                       final List<RegionDef> regionsToFilter );  }