/** * If there is an edge equal to e already in the list, return it. Otherwise return null. * * @return equal edge, if there is one already in the list null otherwise */ public Edge findEqualEdge(final Edge e) { final OrientedCoordinateArray oca = new OrientedCoordinateArray(e.getLine()); // will return null if no edge matches final Edge matchEdge = this.ocaMap.get(oca); return matchEdge; }
/** Insert an edge unless it is already in the list */ public void add(final Edge edge) { this.edges.add(edge); final OrientedCoordinateArray oca = new OrientedCoordinateArray(edge.getLine()); this.ocaMap.put(oca, edge); }