private List<GraphEdge> minOfEdgeLists(GraphEdge accumulatedMin, List<GraphEdge> newMin) { long dstID = accumulatedMin.getDstID(); double x = accumulatedMin.getDstCoords().getFirst(); double y = accumulatedMin.getDstCoords().getSecond(); long weight = accumulatedMin.getWeight(); for (int i = 0; i < newMin.size(); ++i) { dstID = Math.min(dstID, newMin.get(i).getDstID()); x = Math.min(x, newMin.get(i).getDstCoords().getFirst()); y = Math.min(y, newMin.get(i).getDstCoords().getSecond()); weight = Math.min(weight, newMin.get(i).getWeight()); } return Arrays.asList(new GraphEdge(dstID, x, y, weight)); }
private List<GraphEdge> maxOfEdgeLists(GraphEdge accumulatedMax, List<GraphEdge> newMax) { long dstID = accumulatedMax.getDstID(); double x = accumulatedMax.getDstCoords().getFirst(); double y = accumulatedMax.getDstCoords().getSecond(); long weight = accumulatedMax.getWeight(); for (int i = 0; i < newMax.size(); ++i) { dstID = Math.max(dstID, newMax.get(i).getDstID()); x = Math.max(x, newMax.get(i).getDstCoords().getFirst()); y = Math.max(y, newMax.get(i).getDstCoords().getSecond()); weight = Math.max(weight, newMax.get(i).getWeight()); } return Arrays.asList(new GraphEdge(dstID, x, y, weight)); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (null == obj) return false; if (!(obj instanceof GraphEdge)) return false; GraphEdge that = (GraphEdge) obj; if (this.getDstID() != that.getDstID()) { return false; } else if (!(this.getDstCoords().equals(that.getDstCoords()))) { return false; } else if ((this.getWeight() != that.getWeight())) { return false; } else { return true; } }
result += ", "; result += "{\"dstID\": " + edge.getDstID() + ", " + "\"dstCoords\": [" + edge.getDstCoords().getFirst() + ", " + edge.getDstCoords().getSecond() + "], " + "\"weight\": " + edge.getWeight() + "}"; result += ", "; result += "{\"dstID\": " + edge.getDstID() + ", " + "\"dstCoords\": [" + edge.getDstCoords().getFirst() + ", " + edge.getDstCoords().getSecond() + "], " + "\"weight\": " + edge.getWeight() + "}";
GraphEdge rawEdge = interEdges.get(n); edge.put("dstID", rawEdge.getDstID()); edge.put("dstX", rawEdge.getDstCoords().getFirst()); edge.put("dstY", rawEdge.getDstCoords().getSecond()); edge.put("weight", rawEdge.getWeight()); GraphEdge rawEdge = intraEdges.get(n); edge.put("dstID", rawEdge.getDstID()); edge.put("dstX", rawEdge.getDstCoords().getFirst()); edge.put("dstY", rawEdge.getDstCoords().getSecond()); edge.put("weight", rawEdge.getWeight());