本文整理汇总了Java中com.spatial4j.core.shape.Point.hashCode方法的典型用法代码示例。如果您正苦于以下问题:Java Point.hashCode方法的具体用法?Java Point.hashCode怎么用?Java Point.hashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.spatial4j.core.shape.Point
的用法示例。
在下文中一共展示了Point.hashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeShapeConverter
import com.spatial4j.core.shape.Point; //导入方法依赖的package包/类
/**
* Optionally converts points to circles, and optionally bbox'es result.
*/
public static ShapeConverter makeShapeConverter(final SpatialStrategy spatialStrategy,
Config config, String configKeyPrefix) {
//by default does no conversion
final double radiusDegrees = config.get(configKeyPrefix+"radiusDegrees", 0.0);
final double plusMinus = config.get(configKeyPrefix+"radiusDegreesRandPlusMinus", 0.0);
final boolean bbox = config.get(configKeyPrefix + "bbox", false);
return new ShapeConverter() {
@Override
public Shape convert(Shape shape) {
if (shape instanceof Point && (radiusDegrees != 0.0 || plusMinus != 0.0)) {
Point point = (Point)shape;
double radius = radiusDegrees;
if (plusMinus > 0.0) {
Random random = new Random(point.hashCode());//use hashCode so it's reproducibly random
radius += random.nextDouble() * 2 * plusMinus - plusMinus;
radius = Math.abs(radius);//can happen if configured plusMinus > radiusDegrees
}
shape = spatialStrategy.getSpatialContext().makeCircle(point, radius);
}
if (bbox)
shape = shape.getBoundingBox();
return shape;
}
};
}