(HashMap<Double, ArrayList<Line>> linesBySlope, Line line)
| 34 | |
| 35 | /* insert line into hashmap */ |
| 36 | public static void insertLine(HashMap<Double, ArrayList<Line>> linesBySlope, Line line) { |
| 37 | ArrayList<Line> lines = null; |
| 38 | double key = Line.floorToNearestEpsilon(line.slope); |
| 39 | if (!linesBySlope.containsKey(key)) { |
| 40 | lines = new ArrayList<Line>(); |
| 41 | linesBySlope.put(key, lines); |
| 42 | } else { |
| 43 | lines = linesBySlope.get(key); |
| 44 | } |
| 45 | lines.add(line); |
| 46 | } |
| 47 | |
| 48 | |
| 49 | public static Line findBestLine(GraphPoint[] points) { |
no test coverage detected