Пример #1
0
 private static DataSet<Point> getPointDataSet(ParameterTool params, ExecutionEnvironment env) {
   DataSet<Point> points;
   if (params.has("points")) {
     // read points from CSV file
     points =
         env.readCsvFile(params.get("points")).fieldDelimiter(" ").pojoType(Point.class, "x", "y");
   } else {
     System.out.println("Executing K-Means example with default point data set.");
     System.out.println("Use --points to specify file input.");
     points = KMeansData.getDefaultPointDataSet(env);
   }
   return points;
 }
Пример #2
0
 private static DataSet<Centroid> getCentroidDataSet(
     ParameterTool params, ExecutionEnvironment env) {
   DataSet<Centroid> centroids;
   if (params.has("centroids")) {
     centroids =
         env.readCsvFile(params.get("centroids"))
             .fieldDelimiter(" ")
             .pojoType(Centroid.class, "id", "x", "y");
   } else {
     System.out.println("Executing K-Means example with default centroid data set.");
     System.out.println("Use --centroids to specify file input.");
     centroids = KMeansData.getDefaultCentroidDataSet(env);
   }
   return centroids;
 }