@Override public Distance convert(Object obj) { return new Distance((Double)obj, metric); }
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within) { RedisCommand<GeoResults<GeoLocation<byte[]>>> command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", new GeoResultsDecoder()); return read(key, ByteArrayCodec.INSTANCE, command, key, convert(within.getCenter().getX()), convert(within.getCenter().getY()), within.getRadius().getValue(), within.getRadius().getMetric().getAbbreviation()); }
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius) { return read(key, ByteArrayCodec.INSTANCE, GEORADIUSBYMEMBER, key, member, radius.getValue(), radius.getMetric().getAbbreviation()); }
@Override public GeoResults<GeoLocation<byte[]>> decode(List<Object> parts, State state) { List<GeoResult<GeoLocation<byte[]>>> result = new ArrayList<GeoResult<GeoLocation<byte[]>>>(); for (Object object : parts) { if (object instanceof List) { List<Object> vals = ((List<Object>) object); if (metric != null) { GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])vals.get(0), null); result.add(new GeoResult<GeoLocation<byte[]>>(location, new Distance((Double)vals.get(1), metric))); } else { GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])vals.get(0), (Point)vals.get(1)); result.add(new GeoResult<GeoLocation<byte[]>>(location, null)); } } else { GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])object, null); result.add(new GeoResult<GeoLocation<byte[]>>(location, new Distance(0))); } } return new GeoResults<GeoLocation<byte[]>>(result); }
@Override public Point decode(List<Object> parts, State state) { if (parts.isEmpty()) { return null; } Double longitude = (Double)parts.get(0); Double latitude = (Double)parts.get(1); return new Point(longitude, latitude); }
@Override public GeoResults<GeoLocation<byte[]>> decode(List<Object> parts, State state) { List<GeoResult<GeoLocation<byte[]>>> result = new ArrayList<GeoResult<GeoLocation<byte[]>>>(); for (Object object : parts) { List<Object> vals = ((List<Object>) object); GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])vals.get(0), (Point)vals.get(1)); result.add(new GeoResult<GeoLocation<byte[]>>(location, null)); } return new GeoResults<GeoLocation<byte[]>>(result); }
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within) { RedisCommand<GeoResults<GeoLocation<byte[]>>> command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", new GeoResultsDecoder()); return read(key, ByteArrayCodec.INSTANCE, command, key, convert(within.getCenter().getX()), convert(within.getCenter().getY()), within.getRadius().getValue(), within.getRadius().getMetric().getAbbreviation()); }
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius) { return read(key, ByteArrayCodec.INSTANCE, GEORADIUSBYMEMBER, key, member, radius.getValue(), radius.getMetric().getAbbreviation()); }
@Override public GeoResults<GeoLocation<byte[]>> decode(List<Object> parts, State state) { List<GeoResult<GeoLocation<byte[]>>> result = new ArrayList<GeoResult<GeoLocation<byte[]>>>(); for (Object object : parts) { if (object instanceof List) { List<Object> vals = ((List<Object>) object); if (metric != null) { GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])vals.get(0), null); result.add(new GeoResult<GeoLocation<byte[]>>(location, new Distance((Double)vals.get(1), metric))); } else { GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])vals.get(0), (Point)vals.get(1)); result.add(new GeoResult<GeoLocation<byte[]>>(location, null)); } } else { GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])object, null); result.add(new GeoResult<GeoLocation<byte[]>>(location, new Distance(0))); } } return new GeoResults<GeoLocation<byte[]>>(result); }
@Override public Distance convert(Object obj) { return new Distance((Double)obj, metric); }
@Override public Point decode(List<Object> parts, State state) { if (parts.isEmpty()) { return null; } Double longitude = (Double)parts.get(0); Double latitude = (Double)parts.get(1); return new Point(longitude, latitude); }
@Override public GeoResults<GeoLocation<byte[]>> decode(List<Object> parts, State state) { List<GeoResult<GeoLocation<byte[]>>> result = new ArrayList<GeoResult<GeoLocation<byte[]>>>(); for (Object object : parts) { List<Object> vals = ((List<Object>) object); GeoLocation<byte[]> location = new GeoLocation<byte[]>((byte[])vals.get(0), (Point)vals.get(1)); result.add(new GeoResult<GeoLocation<byte[]>>(location, null)); } return new GeoResults<GeoLocation<byte[]>>(result); }
@Override public Distance convert(Object obj) { return new Distance((Double)obj, metric); }
@Override public Point decode(List<Object> parts, State state) { if (parts.isEmpty()) { return null; } Double longitude = (Double)parts.get(0); Double latitude = (Double)parts.get(1); return new Point(longitude, latitude); }
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, double radius) { return geoRadiusByMember(key, member, new Distance(radius, DistanceUnit.METERS)); }
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, double radius) { return geoRadiusByMember(key, member, new Distance(radius, DistanceUnit.METERS)); }