@Test public void testDeltaEncode() { List<Integer> deltaEncoded = DeltaEncoder.deltaEncode(this.mockCoordinates); Assert.assertEquals(Integer.valueOf(52000000), deltaEncoded.get(0)); Assert.assertEquals(Integer.valueOf(13000000), deltaEncoded.get(1)); Assert.assertEquals(Integer.valueOf(100), deltaEncoded.get(2)); Assert.assertEquals(Integer.valueOf(100), deltaEncoded.get(3)); Assert.assertEquals(Integer.valueOf(400), deltaEncoded.get(4)); Assert.assertEquals(Integer.valueOf(400), deltaEncoded.get(5)); Assert.assertEquals(Integer.valueOf(-100), deltaEncoded.get(6)); Assert.assertEquals(Integer.valueOf(-100), deltaEncoded.get(7)); Assert.assertEquals(Integer.valueOf(400), deltaEncoded.get(8)); Assert.assertEquals(Integer.valueOf(400), deltaEncoded.get(9)); Assert.assertEquals(Integer.valueOf(200), deltaEncoded.get(10)); Assert.assertEquals(Integer.valueOf(200), deltaEncoded.get(11)); }
static List<Integer> deltaEncode(List<Integer> list) { if (list == null) { return null; } ArrayList<Integer> result = new ArrayList<Integer>(); if (list.isEmpty()) { return result; } Iterator<Integer> it = list.iterator(); Integer prevLat = it.next(); Integer prevLon = it.next(); result.add(prevLat); result.add(prevLon); while (it.hasNext()) { Integer currentLat = it.next(); Integer currentLon = it.next(); result.add(Integer.valueOf(currentLat.intValue() - prevLat.intValue())); result.add(Integer.valueOf(currentLon.intValue() - prevLon.intValue())); prevLat = currentLat; prevLon = currentLon; } return result; }
DeltaEncoder { static List<Integer> deltaEncode(List<Integer> list) { if (list == null) { return null; } ArrayList<Integer> result = new ArrayList<Integer>(); if (list.isEmpty()) { return result; } Iterator<Integer> it = list.iterator(); Integer prevLat = it.next(); Integer prevLon = it.next(); result.add(prevLat); result.add(prevLon); while (it.hasNext()) { Integer currentLat = it.next(); Integer currentLon = it.next(); result.add(Integer.valueOf(currentLat.intValue() - prevLat.intValue())); result.add(Integer.valueOf(currentLon.intValue() - prevLon.intValue())); prevLat = currentLat; prevLon = currentLon; } return result; } }
DeltaEncoder { static List<Integer> deltaEncode(List<Integer> list) { if (list == null) { return null; } ArrayList<Integer> result = new ArrayList<Integer>(); if (list.isEmpty()) { return result; } Iterator<Integer> it = list.iterator(); Integer prevLat = it.next(); Integer prevLon = it.next(); result.add(prevLat); result.add(prevLon); while (it.hasNext()) { Integer currentLat = it.next(); Integer currentLon = it.next(); result.add(Integer.valueOf(currentLat.intValue() - prevLat.intValue())); result.add(Integer.valueOf(currentLon.intValue() - prevLon.intValue())); prevLat = currentLat; prevLon = currentLon; } return result; } private  DeltaEncoder(); }
DeltaEncoder { static List<Integer> deltaEncode(List<Integer> list) { if (list == null) { return null; } ArrayList<Integer> result = new ArrayList<Integer>(); if (list.isEmpty()) { return result; } Iterator<Integer> it = list.iterator(); Integer prevLat = it.next(); Integer prevLon = it.next(); result.add(prevLat); result.add(prevLon); while (it.hasNext()) { Integer currentLat = it.next(); Integer currentLon = it.next(); result.add(Integer.valueOf(currentLat.intValue() - prevLat.intValue())); result.add(Integer.valueOf(currentLon.intValue() - prevLon.intValue())); prevLat = currentLat; prevLon = currentLon; } return result; } private  DeltaEncoder(); static List<WayDataBlock> encode(List<WayDataBlock> blocks, Encoding encoding); static int simulateSerialization(List<WayDataBlock> blocks); }
DeltaEncoder { static List<Integer> deltaEncode(List<Integer> list) { if (list == null) { return null; } ArrayList<Integer> result = new ArrayList<Integer>(); if (list.isEmpty()) { return result; } Iterator<Integer> it = list.iterator(); Integer prevLat = it.next(); Integer prevLon = it.next(); result.add(prevLat); result.add(prevLon); while (it.hasNext()) { Integer currentLat = it.next(); Integer currentLon = it.next(); result.add(Integer.valueOf(currentLat.intValue() - prevLat.intValue())); result.add(Integer.valueOf(currentLon.intValue() - prevLon.intValue())); prevLat = currentLat; prevLon = currentLon; } return result; } private  DeltaEncoder(); static List<WayDataBlock> encode(List<WayDataBlock> blocks, Encoding encoding); static int simulateSerialization(List<WayDataBlock> blocks);  }