public static void main(String[] args) { Phone phone = new Iphone(); GPS gps = new GPS(); gps.setPhone(phone); gps.sendMessage(); gps.callPhone(); }
private Double getDistanceInKilometresForCorner(final GPS point, final GlobalPosition start) { final GlobalPosition endFirstCorner = new GlobalPosition(point.getDecimalLatitude(), point.getDecimalLongitude(), 0.0); final GeodeticMeasurement measurementForFirstCorner = geodeticCalculator.calculateGeodeticMeasurement( Ellipsoid.KRASSOWSKI, start, endFirstCorner); return Double.valueOf(measurementForFirstCorner.getPointToPointDistance() / METRES_IN_KM); }
/** Test of getOutput method, of class GPS with noise. */ @Test public void testNoisyOutput() { System.out.println("getOutput with noise"); // Set up test data GPS instance = new GPS(0.2); XPoint location = new XPoint(10, 20); SensorTestingRobot robot = new SensorTestingRobot(0, location, 0); instance.setObject(robot); // Check the values are correct assertEquals(10, instance.getOutput().getX(), 10 * 0.2); assertEquals(20, instance.getOutput().getY(), 20 * 0.2); }
static{ map.put("서울역", GPS.newLocation(0,0) ); map.put("시청역", GPS.newLocation(0,1) ); map.put("사당역", GPS.newLocation(2,-10) ); map.put("신도림역", GPS.newLocation(-10,-5) ); map.put("잠실역", GPS.newLocation(12,-7) ); map.put("가산디지털단지역", GPS.newLocation(-7,-7) ); map.put("수원역", GPS.newLocation(-20,-2) ); map.put("오산역", GPS.newLocation(-30,-2) ); }
public JSONObject toJSON() { JSONObject obj = new JSONObject(); try { putSafe(obj, "time", time); putSafe(obj, "localtime", localTime); putSafe(obj, "deviceid", SHA1Util.SHA1(deviceId)); JSONArray array = new JSONArray(); try { for (Ping p : pings) { array.put(p.toJSON()); } } catch (Exception e) { } putSafe(obj, "pings", array); JSONArray tmparray = new JSONArray(); try { for (LastMile p : lastMiles) { tmparray.put(p.toJSON()); } } catch (Exception e) { } putSafe(obj, "lastmiles", tmparray); JSONArray array2 = new JSONArray(); for (Screen s : screens) { array2.put(s.toJSON()); } if (screens != null) putSafe(obj, "screens", array2); if (device != null) putSafe(obj, "device", device.toJSON()); if (throughput != null) putSafe(obj, "throughput", throughput.toJSON()); if (gps != null) putSafe(obj, "gps", gps.toJSON()); if (battery != null) putSafe(obj, "battery", battery.toJSON()); if (usage != null) putSafe(obj, "usage", usage.toJSON()); if (network != null) putSafe(obj, "network", network.toJSON()); if (warmupExperiment != null) putSafe(obj, "warmup_experiment", warmupExperiment.toJSON()); if (sim != null) putSafe(obj, "sim", sim.toJSON()); if (wifi != null) putSafe(obj, "wifi", wifi.toJSON()); if (state != null) putSafe(obj, "state", state.toJSON()); if (isManual) putSafe(obj, "isManual", 1); else putSafe(obj, "isManual", 0); if (loss != null) putSafe(obj, "loss", loss.toJSON()); if (ipdv != null) putSafe(obj, "delay_variation", ipdv.toJSON()); } catch (Exception e) { e.printStackTrace(); } printJSON(obj.toString()); return obj; }
@Override public Location getClientLocation(int user_id) throws DataStoreFailureException { Location loc = new Location(); GPS gps = new GPS(); loc.setGps(gps); switch (user_id) { case 0: return Utility.initLocationInstance(); case 1: gps.setLat(55.56); gps.setLon(66.66); break; case 2: gps.setLat(56.00); gps.setLon(67.00); break; case 3: gps.setLat(90.00); gps.setLon(00.00); break; } return loc; }