private Map<Integer, Waypoint> createWaypointByWaypointId() { Map<Integer, Waypoint> waypointByWaypointIdMap = new TreeMap<Integer, Waypoint>(); for (Waypoint wPoint : waypoints) { waypointByWaypointIdMap.put(wPoint.getId(), wPoint); } return waypointByWaypointIdMap; }
private List<Waypoint> createAllWaypointsFromExternalFile() throws IOException { List<Waypoint> result = new ArrayList<Waypoint>(); String fileName = "waypoints.csv"; InputStream is = context.getAssets().open(fileName); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String readStr; br.readLine(); // 첫 줄 버림. while ((readStr = br.readLine()) != null) { String[] tokens = readStr.split(delimiter); Waypoint wayPoint = new Waypoint(); wayPoint.setId(Integer.parseInt(tokens[0])); wayPoint.setX(Double.parseDouble(tokens[1])); wayPoint.se Integer avgSignalStrength = 0; for (Integer signalStrength : signalsByApId.get(apId)) { avgSignalStrength = avgSignalStrength + signalStrength; } avgSignalStrength = (int) ((double) avgSignalStrength / (double) signalsByApId .get(apId).size()); representiveApSet.add(new ApSet(fingerprintId, apId, avgSignalStrength)); } newApSets.addAll(representiveApSet); Fingerprint representiveFingerprint = new Fingerprint( fingerprintId, time, x, y, z); this.fingerprints.add(representiveFingerprint); this.fingerprintByFingerprintIdMap.put(fingerprintId, representiveFingerprint); newFingerprintByCoordinateMap.put(coordinate, representiveFingerprint); newApSetsByFingerprintIdMap.put(fingerprintId, representiveApSet); fingerprintId++; }
private Map<Double, List<WaypointLink>> createWaypointLinksByZ() { Map<Double, List<WaypointLink>> waypointLinksByZMap = new TreeMap<Double, List<WaypointLink>>(); for (WaypointLink wayLink : waypointLinks) { Waypoint waypoint = waypointByWaypointIdMap.get(wayLink .getStartPointId()); if (waypointLinksByZMap.get(waypoint.getZ()) == null) { waypointLinksByZMap.put(waypoint.getZ(), new ArrayList<WaypointLink>()); } waypointLinksByZMap.get(waypoint.getZ()).add(wayLink); } return waypointLinksByZMap; }