Class Anonymizer.CoordinatesAnonymizer

java.lang.Object
overit.geocall.basic.anonymizer.Anonymizer.CoordinatesAnonymizer
Enclosing class:
Anonymizer

public class Anonymizer.CoordinatesAnonymizer extends Object
Anonymizer used to obfuscate the fields containing the latitude and longitude coordinates. If the context doesn't contains the fields assigned to this instance, all'the method of this class will not change the context.
  • Field Details

  • Constructor Details

    • CoordinatesAnonymizer

      protected CoordinatesAnonymizer(String latitudeField, String longitudeField)
  • Method Details

    • anonymizeCircle

      public Anonymizer.CoordinatesAnonymizer anonymizeCircle(double radius)
      Generates a random coordinate value in the neighborhood of the current coordinates and sets it as the value of both fields assigned to this instance.
      Parameters:
      radius - the size of the radius expressed as decimal degrees. This parameter defines a circular area within which a new coordinate will be generated.
      Returns:
      a reference of this object.
    • anonymizeRect

      public Anonymizer.CoordinatesAnonymizer anonymizeRect(double offset)
      Generates a random coordinate value in the neighborhood of the current coordinates and sets it as the value of both fields assigned to this instance.
      Parameters:
      offset - the size of the neighbourhood expressed as decimal degrees. The random value will be included between currentLatitude - offset and currentLatitude + offset; in other words this parameter defines a square area within which a new coordinate will be generated.
      Returns:
      a reference of this object.
      Throws:
      overit.geocall.asserts.AssertsException - if offset is negative.
    • setLatitude

      public Anonymizer.CoordinatesAnonymizer setLatitude(Double value)
      Set forcibly the value for the latitude's field.
      Parameters:
      value - latitude, expressed in decimal degrees. If null, will be set the null value. If the context doesn't contains the field, nothing will happens.
      Returns:
      a reference of this object.
    • anonymizeLatitude

      public Anonymizer.CoordinatesAnonymizer anonymizeLatitude()
      Set a random latitude (between -90° and 90°) as value of the latitude's field assigned to this instance.
      Returns:
      a reference of this object.
    • anonymizeLatitude

      public Anonymizer.CoordinatesAnonymizer anonymizeLatitude(double offset)
      Generate a random latitude within the neighbourhood of the current field's value and set it as value of the latitude's field assigned to this instance.
      Parameters:
      offset - the size of the neighbourhood expressed as latitude's decimal degrees. The random value will be included between currentLatitude - offset and currentLatitude + offset
      Returns:
      a reference of this object.
      Throws:
      overit.geocall.asserts.AssertsException - if offset is negative.
    • anonymizeLatitude

      public Anonymizer.CoordinatesAnonymizer anonymizeLatitude(double from, double to)
      Generate a random latitude between a given range and set it as value of the latitude's field assigned to this instance.
      Parameters:
      from - the lower bound value (included).
      to - the lower upper value (excluded).
      Returns:
      a reference of this object.
      Throws:
      overit.geocall.asserts.AssertsException - if lower bound value is greater equals than the upper bound ones.
    • setLongitude

      public Anonymizer.CoordinatesAnonymizer setLongitude(Double value)
      Set forcibly the value for the longitude's field.
      Parameters:
      value - longitude, expressed in decimal degrees. If null, will be set the null value. If the context doesn't contains the field, nothing will happens.
      Returns:
      a reference of this object.
    • anonymizeLongitude

      public Anonymizer.CoordinatesAnonymizer anonymizeLongitude()
      Set a random longitude (between -180° and 180°) as value of the longitude's field assigned to this instance.
      Returns:
      a reference of this object.
    • anonymizeLongitude

      public Anonymizer.CoordinatesAnonymizer anonymizeLongitude(double offset)
      Generate a random longitude within the neighbourhood of the current field's value and set it as value of the longitude's field assigned to this instance.
      Parameters:
      offset - the size of the neighbourhood expressed as longitude's decimal degrees. The random value will be included between currentlongitude - offset and currentlongitude + offset
      Returns:
      a reference of this object.
      Throws:
      overit.geocall.asserts.AssertsException - if offset is negative.
    • anonymizeLongitude

      public Anonymizer.CoordinatesAnonymizer anonymizeLongitude(double from, double to)
      Generate a random latitude between a given range and set it as value of the longitude's field assigned to this instance.
      Parameters:
      from - the lower bound value (included).
      to - the lower upper value (excluded).
      Returns:
      a reference of this object.
      Throws:
      overit.geocall.asserts.AssertsException - if lower bound value is greater equals than the upper bound ones.