Source:
<code>public static APIQueryControlResult submitQuery(final Configuration configuration) throws IOException, InjectionException, URISyntaxException { final String sourceSocket = Tang.Factory.getTang().newInjector(configuration).getNamedInstance(SourceAddress.class); final TextSocketSourceConfiguration localTextSocketSourceConf = MISTExampleUtils.getLocalTextSocketSourceConf(sourceSocket); final TextSocketSinkConfiguration localTextSocketSinkConf = MISTExampleUtils.getLocalTextSocketSinkConf(); final MISTBiConsumer<Point, OperatorState<KMeansState>> updateClusterCons = (newPoint, opState) -> { final KMeansState state = opState.get(); state.clustering(newPoint); }; final MISTFunction<KMeansState, List<String>> produceResultFunc = (state) -> { final List<String> results = new LinkedList<>(); final Iterator<Cluster> clustersItr = state.getClusters().iterator(); for (int i = 1; clustersItr.hasNext(); i++) { final Cluster cluster = clustersItr.next(); String clusterResult = "Cluster id: " + i + ", cluster center: " + cluster.getCenter().toString() + "\n"; <START> final Iterator<Point> clusterPointItr = cluster.getClusterPoints().iterator(); <END> while (clusterPointItr.hasNext()) { clusterResult += clusterPointItr.next().toString() + "\n"; } results.add(clusterResult); } return results; }; final MISTSupplier<KMeansState> initializeStateSup = () -> new KMeansState(); final MISTQueryBuilder queryBuilder = new MISTQueryBuilder(); queryBuilder.socketTextStream(localTextSocketSourceConf) .map(s -> s.replaceAll(" ", "")) .filter(s -> Pattern.matches("-?\\d+\\.\\d+,-?\\d+\\.\\d+", s)) .map(s -> { final String[] array = s.split(","); return new Point(Double.parseDouble(array[0]), Double.parseDouble(array[1])); }) .applyStateful(updateClusterCons, produceResultFunc, initializeStateSup) .flatMap(stringList -> stringList) .textSocketOutput(localTextSocketSinkConf); final MISTQuery query = queryBuilder.build(); return MISTExampleUtils.submit(query, configuration); }</code><technical_language>for (final Point point : cluster.getClusteredPoints())</technical_language>

Target:
public static APIQueryControlResult submitQuery(final Configuration configuration) throws IOException, InjectionException, URISyntaxException { final String sourceSocket = Tang.Factory.getTang().newInjector(configuration).getNamedInstance(SourceAddress.class); final TextSocketSourceConfiguration localTextSocketSourceConf = MISTExampleUtils.getLocalTextSocketSourceConf(sourceSocket); final TextSocketSinkConfiguration localTextSocketSinkConf = MISTExampleUtils.getLocalTextSocketSinkConf(); final MISTBiConsumer<Point, OperatorState<KMeansState>> updateClusterCons = (newPoint, opState) -> { final KMeansState state = opState.get(); state.clustering(newPoint); }; final MISTFunction<KMeansState, List<String>> produceResultFunc = (state) -> { final List<String> results = new LinkedList<>(); for (final Cluster cluster : state.getClusters()) { String clusterResult = "Cluster id: " + cluster.getId() + ", cluster center: " + cluster.getCenter().toString() + "\n"; for (final Point point : cluster.getClusteredPoints()) { clusterResult += point.toString() + "\n"; } results.add(clusterResult); } return results; }; final MISTSupplier<KMeansState> initializeStateSup = () -> new KMeansState(); final MISTQueryBuilder queryBuilder = new MISTQueryBuilder(); queryBuilder.socketTextStream(localTextSocketSourceConf) .map(s -> s.replaceAll(" ", "")) .filter(s -> Pattern.matches("-?\\d+\\.\\d+,-?\\d+\\.\\d+", s)) .map(s -> { final String[] array = s.split(","); return new Point(Double.parseDouble(array[0]), Double.parseDouble(array[1])); }) .applyStateful(updateClusterCons, produceResultFunc, initializeStateSup) .flatMap(stringList -> stringList) .textSocketOutput(localTextSocketSinkConf); final MISTQuery query = queryBuilder.build(); return MISTExampleUtils.submit(query, configuration); }