@Test public void testCalculateProjectionOrder() { double originalSplitValue = getSplitValue(); setSplitValue(0); Projector projector = new Projector(); projector.setGHStorage(ToyGraphCreationUtil.createMediumGraph2(encodingManager)); Map<Projector.Projection, IntArrayList> projections = projector.calculateProjections(); List<Projector.Projection> projectionOrder = projector.calculateProjectionOrder(projections); assertEquals(Projector.Projection.LINE_P675, projectionOrder.get(0)); assertEquals(Projector.Projection.LINE_P45, projectionOrder.get(1)); assertEquals(Projector.Projection.LINE_M225, projectionOrder.get(7)); setSplitValue(originalSplitValue); }
protected List<Projection> calculateProjectionOrder(Map<Projection, IntArrayList> projections) { List<Projection> order; EnumMap<Projection, Double> squareRangeProjMap = new EnumMap<>(Projection.class); EnumMap<Projection, Double> orthogonalDiffProjMap = new EnumMap<>(Projection.class); for (Map.Entry<Projection, IntArrayList> proj : projections.entrySet()) { int idx = (int) (proj.getValue().size() * getSplitValue()); squareRangeProjMap.put(proj.getKey(), projIndividualValue(projections, proj.getKey(), idx)); } for (Projection proj : projections.keySet()) { orthogonalDiffProjMap.put(proj, projCombinedValue(squareRangeProjMap, proj)); } Sort sort = new Sort(); order = sort.sortByValueReturnList(orthogonalDiffProjMap, false); return order; }
Projector { protected List<Projection> calculateProjectionOrder(Map<Projection, IntArrayList> projections) { List<Projection> order; EnumMap<Projection, Double> squareRangeProjMap = new EnumMap<>(Projection.class); EnumMap<Projection, Double> orthogonalDiffProjMap = new EnumMap<>(Projection.class); for (Map.Entry<Projection, IntArrayList> proj : projections.entrySet()) { int idx = (int) (proj.getValue().size() * getSplitValue()); squareRangeProjMap.put(proj.getKey(), projIndividualValue(projections, proj.getKey(), idx)); } for (Projection proj : projections.keySet()) { orthogonalDiffProjMap.put(proj, projCombinedValue(squareRangeProjMap, proj)); } Sort sort = new Sort(); order = sort.sortByValueReturnList(orthogonalDiffProjMap, false); return order; } }
Projector { protected List<Projection> calculateProjectionOrder(Map<Projection, IntArrayList> projections) { List<Projection> order; EnumMap<Projection, Double> squareRangeProjMap = new EnumMap<>(Projection.class); EnumMap<Projection, Double> orthogonalDiffProjMap = new EnumMap<>(Projection.class); for (Map.Entry<Projection, IntArrayList> proj : projections.entrySet()) { int idx = (int) (proj.getValue().size() * getSplitValue()); squareRangeProjMap.put(proj.getKey(), projIndividualValue(projections, proj.getKey(), idx)); } for (Projection proj : projections.keySet()) { orthogonalDiffProjMap.put(proj, projCombinedValue(squareRangeProjMap, proj)); } Sort sort = new Sort(); order = sort.sortByValueReturnList(orthogonalDiffProjMap, false); return order; } Projector(); }
Projector { protected List<Projection> calculateProjectionOrder(Map<Projection, IntArrayList> projections) { List<Projection> order; EnumMap<Projection, Double> squareRangeProjMap = new EnumMap<>(Projection.class); EnumMap<Projection, Double> orthogonalDiffProjMap = new EnumMap<>(Projection.class); for (Map.Entry<Projection, IntArrayList> proj : projections.entrySet()) { int idx = (int) (proj.getValue().size() * getSplitValue()); squareRangeProjMap.put(proj.getKey(), projIndividualValue(projections, proj.getKey(), idx)); } for (Projection proj : projections.keySet()) { orthogonalDiffProjMap.put(proj, projCombinedValue(squareRangeProjMap, proj)); } Sort sort = new Sort(); order = sort.sortByValueReturnList(orthogonalDiffProjMap, false); return order; } Projector(); void setGHStorage(GraphHopperStorage ghStorage); }
Projector { protected List<Projection> calculateProjectionOrder(Map<Projection, IntArrayList> projections) { List<Projection> order; EnumMap<Projection, Double> squareRangeProjMap = new EnumMap<>(Projection.class); EnumMap<Projection, Double> orthogonalDiffProjMap = new EnumMap<>(Projection.class); for (Map.Entry<Projection, IntArrayList> proj : projections.entrySet()) { int idx = (int) (proj.getValue().size() * getSplitValue()); squareRangeProjMap.put(proj.getKey(), projIndividualValue(projections, proj.getKey(), idx)); } for (Projection proj : projections.keySet()) { orthogonalDiffProjMap.put(proj, projCombinedValue(squareRangeProjMap, proj)); } Sort sort = new Sort(); order = sort.sortByValueReturnList(orthogonalDiffProjMap, false); return order; } Projector(); void setGHStorage(GraphHopperStorage ghStorage);  }