@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[]>> 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[]>> 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 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); }
@Nullable public GeoResult<T> doWith(@Nullable Document object) { double distance = ((Double) object.get("dis")).doubleValue(); Document content = (Document) object.get("obj"); T doWith = delegate.doWith(content); return new GeoResult<>(doWith, new Distance(distance, metric)); } }
/** * Get {@link Converter} capable of {@link Set} of {@link Byte} into {@link GeoResults}. * * @return * @since 1.8 */ public static Converter<Set<byte[]>, GeoResults<GeoLocation<byte[]>>> bytesSetToGeoResultsConverter() { return source -> { if (CollectionUtils.isEmpty(source)) { return new GeoResults<>(Collections.<GeoResult<GeoLocation<byte[]>>> emptyList()); } List<GeoResult<GeoLocation<byte[]>>> results = new ArrayList<>(source.size()); Iterator<byte[]> it = source.iterator(); while (it.hasNext()) { results.add(new GeoResult<>(new GeoLocation<>(it.next(), null), new Distance(0D))); } return new GeoResults<>(results); }; }
public GeoResult<T> doWith(Document object) { double distance = (Double) object.get("dis"); Document content = (Document) object.get("obj"); T doWith = delegate.doWith(content); return new GeoResult<>(doWith, new Distance(distance, metric)); } }
@Override public GeoResults<GeoLocation<V>> convert(GeoResults<GeoLocation<byte[]>> source) { List<GeoResult<GeoLocation<V>>> values = new ArrayList<>(source.getContent().size()); for (GeoResult<GeoLocation<byte[]>> value : source.getContent()) { values.add(new GeoResult<>( new GeoLocation<>(serializer.deserialize(value.getContent().getName()), value.getContent().getPoint()), value.getDistance())); } return new GeoResults<>(values, source.getAverageDistance().getMetric()); } }
private GeoResult<GeoLocation<V>> readGeoResult(GeoResult<GeoLocation<ByteBuffer>> source) { return new GeoResult<>(new GeoLocation(readValue(source.getContent().getName()), source.getContent().getPoint()), source.getDistance()); } }
@Override public GeoResult<GeoLocation<byte[]>> convert(redis.clients.jedis.GeoRadiusResponse source) { Point point = GEO_COORDINATE_TO_POINT_CONVERTER.convert(source.getCoordinate()); return new GeoResult<>(new GeoLocation<>(source.getMember(), point), new Distance(source.getDistance(), metric)); } }
private Converter<GeoWithin<ByteBuffer>, GeoResult<GeoLocation<ByteBuffer>>> converter(Metric metric) { return (source) -> { Point point = LettuceConverters.geoCoordinatesToPoint(source.getCoordinates()); return new GeoResult<>(new GeoLocation<>(source.getMember(), point), new Distance(source.getDistance() != null ? source.getDistance() : 0D, metric)); }; } }
@Override public GeoResult<GeoLocation<byte[]>> convert(GeoWithin<byte[]> source) { Point point = GEO_COORDINATE_TO_POINT_CONVERTER.convert(source.getCoordinates()); return new GeoResult<>(new GeoLocation<>(source.getMember(), point), new Distance(source.getDistance() != null ? source.getDistance() : 0D, metric)); } }
@Nullable public GeoResult<T> doWith(@Nullable Document object) { double distance = ((Double) object.get("dis")).doubleValue(); Document content = (Document) object.get("obj"); T doWith = delegate.doWith(content); return new GeoResult<>(doWith, new Distance(distance, metric)); } }
public GeoResult<T> doWith(Document object) { double distance = (Double) object.get("dis"); Document content = (Document) object.get("obj"); T doWith = delegate.doWith(content); return new GeoResult<>(doWith, new Distance(distance, metric)); } }
@Override public GeoResults<GeoLocation<V>> convert(GeoResults<GeoLocation<byte[]>> source) { List<GeoResult<GeoLocation<V>>> values = new ArrayList<>(source.getContent().size()); for (GeoResult<GeoLocation<byte[]>> value : source.getContent()) { values.add(new GeoResult<>( new GeoLocation<>(serializer.deserialize(value.getContent().getName()), value.getContent().getPoint()), value.getDistance())); } return new GeoResults<>(values, source.getAverageDistance().getMetric()); } }
@Override public GeoResult<GeoLocation<byte[]>> convert(redis.clients.jedis.GeoRadiusResponse source) { Point point = GEO_COORDINATE_TO_POINT_CONVERTER.convert(source.getCoordinate()); return new GeoResult<>(new GeoLocation<>(source.getMember(), point), new Distance(source.getDistance(), metric)); } }
private GeoResult<GeoLocation<V>> readGeoResult(GeoResult<GeoLocation<ByteBuffer>> source) { return new GeoResult<>(new GeoLocation(readValue(source.getContent().getName()), source.getContent().getPoint()), source.getDistance()); } }
private GeoResult<GeoLocation<V>> readGeoResult(GeoResult<GeoLocation<ByteBuffer>> source) { return new GeoResult<>(new GeoLocation(readValue(source.getContent().getName()), source.getContent().getPoint()), source.getDistance()); } }
private Converter<GeoWithin<ByteBuffer>, GeoResult<GeoLocation<ByteBuffer>>> converter(Metric metric) { return (source) -> { Point point = LettuceConverters.geoCoordinatesToPoint(source.getCoordinates()); return new GeoResult<>(new GeoLocation<>(source.getMember(), point), new Distance(source.getDistance() != null ? source.getDistance() : 0D, metric)); }; } }
@Override public GeoResult<GeoLocation<byte[]>> convert(GeoWithin<byte[]> source) { Point point = GEO_COORDINATE_TO_POINT_CONVERTER.convert(source.getCoordinates()); return new GeoResult<>(new GeoLocation<>(source.getMember(), point), new Distance(source.getDistance() != null ? source.getDistance() : 0D, metric)); } }