Class PlanetModel.DocValueEncoder

java.lang.Object
org.apache.lucene.spatial3d.geom.PlanetModel.DocValueEncoder
Enclosing class:
PlanetModel

public static class PlanetModel.DocValueEncoder extends Object
Utility class for encoding / decoding from lat/lon (decimal degrees) into sortable doc value numerics (integers)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final double
     
    private final double
     
    private final double
     
    private final double
     
    private final PlanetModel
     
    private static final double
     
    private final double
     
    private final double
     
    private final double
     
    private final double
     
    private final double
     
    private final double
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    construct an encoder/decoder instance from the provided PlanetModel definition
  • Method Summary

    Modifier and Type
    Method
    Description
    decodePoint(long docValue)
    Decode GeoPoint value from long docvalues value.
    private double
    decodeX(int x)
     
    double
    decodeXValue(long docValue)
    Decode X value from long docvalues value.
    private double
    decodeY(int y)
     
    double
    decodeYValue(long docValue)
    Decode Y value from long docvalues value.
    private double
    decodeZ(int z)
     
    double
    decodeZValue(long docValue)
    Decode Z value from long docvalues value.
    long
    encodePoint(double x, double y, double z)
    Encode a point.
    long
    Encode a point.
    private int
    encodeX(double x)
     
    private int
    encodeY(double y)
     
    private int
    encodeZ(double z)
     
    double
    roundDownX(double startValue)
    Round the provided X value down, by encoding it, decrementing it, and unencoding it.
    double
    roundDownY(double startValue)
    Round the provided Y value down, by encoding it, decrementing it, and unencoding it.
    double
    roundDownZ(double startValue)
    Round the provided Z value down, by encoding it, decrementing it, and unencoding it.
    double
    roundUpX(double startValue)
    Round the provided X value up, by encoding it, incrementing it, and unencoding it.
    double
    roundUpY(double startValue)
    Round the provided Y value up, by encoding it, incrementing it, and unencoding it.
    double
    roundUpZ(double startValue)
    Round the provided Z value up, by encoding it, incrementing it, and unencoding it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • planetModel

      private final PlanetModel planetModel
    • inverseMaximumValue

      private static final double inverseMaximumValue
      See Also:
    • inverseXFactor

      private final double inverseXFactor
    • inverseYFactor

      private final double inverseYFactor
    • inverseZFactor

      private final double inverseZFactor
    • xFactor

      private final double xFactor
    • yFactor

      private final double yFactor
    • zFactor

      private final double zFactor
    • STEP_FUDGE

      private static final double STEP_FUDGE
      See Also:
    • xStep

      private final double xStep
    • yStep

      private final double yStep
    • zStep

      private final double zStep
  • Constructor Details

    • DocValueEncoder

      private DocValueEncoder(PlanetModel planetModel)
      construct an encoder/decoder instance from the provided PlanetModel definition
  • Method Details

    • encodePoint

      public long encodePoint(GeoPoint point)
      Encode a point.
      Parameters:
      point - is the point
      Returns:
      the encoded long
    • encodePoint

      public long encodePoint(double x, double y, double z)
      Encode a point.
      Parameters:
      x - is the x value
      y - is the y value
      z - is the z value
      Returns:
      the encoded long
    • decodePoint

      public GeoPoint decodePoint(long docValue)
      Decode GeoPoint value from long docvalues value.
      Parameters:
      docValue - is the doc values value.
      Returns:
      the GeoPoint.
    • decodeXValue

      public double decodeXValue(long docValue)
      Decode X value from long docvalues value.
      Parameters:
      docValue - is the doc values value.
      Returns:
      the x value.
    • decodeYValue

      public double decodeYValue(long docValue)
      Decode Y value from long docvalues value.
      Parameters:
      docValue - is the doc values value.
      Returns:
      the y value.
    • decodeZValue

      public double decodeZValue(long docValue)
      Decode Z value from long docvalues value.
      Parameters:
      docValue - is the doc values value.
      Returns:
      the z value.
    • roundDownX

      public double roundDownX(double startValue)
      Round the provided X value down, by encoding it, decrementing it, and unencoding it.
      Parameters:
      startValue - is the starting value.
      Returns:
      the rounded value.
    • roundUpX

      public double roundUpX(double startValue)
      Round the provided X value up, by encoding it, incrementing it, and unencoding it.
      Parameters:
      startValue - is the starting value.
      Returns:
      the rounded value.
    • roundDownY

      public double roundDownY(double startValue)
      Round the provided Y value down, by encoding it, decrementing it, and unencoding it.
      Parameters:
      startValue - is the starting value.
      Returns:
      the rounded value.
    • roundUpY

      public double roundUpY(double startValue)
      Round the provided Y value up, by encoding it, incrementing it, and unencoding it.
      Parameters:
      startValue - is the starting value.
      Returns:
      the rounded value.
    • roundDownZ

      public double roundDownZ(double startValue)
      Round the provided Z value down, by encoding it, decrementing it, and unencoding it.
      Parameters:
      startValue - is the starting value.
      Returns:
      the rounded value.
    • roundUpZ

      public double roundUpZ(double startValue)
      Round the provided Z value up, by encoding it, incrementing it, and unencoding it.
      Parameters:
      startValue - is the starting value.
      Returns:
      the rounded value.
    • encodeX

      private int encodeX(double x)
    • decodeX

      private double decodeX(int x)
    • encodeY

      private int encodeY(double y)
    • decodeY

      private double decodeY(int y)
    • encodeZ

      private int encodeZ(double z)
    • decodeZ

      private double decodeZ(int z)