Skip to main content
Code Review

Return to Question

Commonmark migration
Source Link

###Questions:

Questions:

###The Code:

The Code:

###Questions:

###The Code:

Questions:

The Code:

tried to clarify title and question
Source Link
RubberDuck
  • 31.2k
  • 6
  • 74
  • 176

Coding on Point interfaces/superclasses notinstead of implementations

###Questions:

  1. Should I be using Point2DAdvanced or Point2D.Double in the the methods of MedianPoint (like JavaRDD<>, the 2 private methods, the variables)? Same goes for FlagPointPairProducer.
  2. Should I be using MedianPoint or Point2D.Double in the FlagPointPairProducer class?
  3. Should I store the MedianPoint from the static method in a MedianPoint or Point2D.Double?

###The Code:

First off I have a MedianPoint class which extends Point2D.Double. This class is responsible for outputting a median point out of a collection of points (for now only an RDD).

The code review I need now is this:

  1. Should I be using Point2DAdvanced or Point2D.Double in the the methods of MedianPoint (like JavaRDD<>, the 2 private methods, the variables)? Same goes for FlagPointPairProducer.
  2. Should I be using MedianPoint or Point2D.Double in the FlagPointPairProducer class?
  3. Should I store the MedianPoint from the static method in a MedianPoint or Point2D.Double?

Coding on interfaces/superclasses not implementations

First off I have a MedianPoint class which extends Point2D.Double. This class is responsible for outputting a median point out of a collection of points (for now only an RDD).

The code review I need now is this:

  1. Should I be using Point2DAdvanced or Point2D.Double in the the methods of MedianPoint (like JavaRDD<>, the 2 private methods, the variables)? Same goes for FlagPointPairProducer.
  2. Should I be using MedianPoint or Point2D.Double in the FlagPointPairProducer class?
  3. Should I store the MedianPoint from the static method in a MedianPoint or Point2D.Double?

Coding on Point interfaces/superclasses instead of implementations

###Questions:

  1. Should I be using Point2DAdvanced or Point2D.Double in the the methods of MedianPoint (like JavaRDD<>, the 2 private methods, the variables)? Same goes for FlagPointPairProducer.
  2. Should I be using MedianPoint or Point2D.Double in the FlagPointPairProducer class?
  3. Should I store the MedianPoint from the static method in a MedianPoint or Point2D.Double?

###The Code:

First off I have a MedianPoint class which extends Point2D.Double. This class is responsible for outputting a median point out of a collection of points (for now only an RDD).

added 1090 characters in body
Source Link
Aki K
  • 1.3k
  • 3
  • 11
  • 25

Code requested for Point2DAdvanced:

public class Point2DAdvanced extends Point2D.Double implements Serializable {
 public Point2DAdvanced(double x, double y) {
 super(x, y);
 }
 public boolean dominates(Point2D.Double point) {
 return (x <= point.getX() && y < point.getY())
 || (y <= point.getY() && x < point.getX());
 }
 @Override
 public String toString() {
 StringBuilder builder = new StringBuilder();
 builder.append('(').append(x).append(", ").append(y).append(')');
 return builder.toString();
 }
 public static Point2DAdvanced fromTextLine(String textLine, String delimiter) {
 textLine = textLine.trim();
 String[] lineArray = textLine.split(delimiter);
 double x = java.lang.Double.parseDouble(lineArray[0]);
 double y = java.lang.Double.parseDouble(lineArray[1]);
 return new Point2DAdvanced(x, y);
 }
}

Code requested for Point2DAdvanced:

public class Point2DAdvanced extends Point2D.Double implements Serializable {
 public Point2DAdvanced(double x, double y) {
 super(x, y);
 }
 public boolean dominates(Point2D.Double point) {
 return (x <= point.getX() && y < point.getY())
 || (y <= point.getY() && x < point.getX());
 }
 @Override
 public String toString() {
 StringBuilder builder = new StringBuilder();
 builder.append('(').append(x).append(", ").append(y).append(')');
 return builder.toString();
 }
 public static Point2DAdvanced fromTextLine(String textLine, String delimiter) {
 textLine = textLine.trim();
 String[] lineArray = textLine.split(delimiter);
 double x = java.lang.Double.parseDouble(lineArray[0]);
 double y = java.lang.Double.parseDouble(lineArray[1]);
 return new Point2DAdvanced(x, y);
 }
}
Source Link
Aki K
  • 1.3k
  • 3
  • 11
  • 25
Loading
lang-java

AltStyle によって変換されたページ (->オリジナル) /