Package overit.geocall.basic.anonymizer
Class Anonymizer.CoordinatesAnonymizer
java.lang.Object
overit.geocall.basic.anonymizer.Anonymizer.CoordinatesAnonymizer
- Enclosing class:
Anonymizer
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 Summary
FieldsModifier and TypeFieldDescriptionprotected Anonymizer.CoordinateAnonymizerprotected Anonymizer.CoordinateAnonymizer -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCoordinatesAnonymizer(String latitudeField, String longitudeField) -
Method Summary
Modifier and TypeMethodDescriptionanonymizeCircle(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.Set a random latitude (between -90° and 90°) as value of the latitude's field assigned to this instance.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.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.Set a random longitude (between -180° and 180°) as value of the longitude's field assigned to this instance.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.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.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.setLatitude(Double value) Set forcibly the value for the latitude's field.setLongitude(Double value) Set forcibly the value for the longitude's field.
-
Field Details
-
_lat
-
_lng
-
-
Constructor Details
-
CoordinatesAnonymizer
-
-
Method Details
-
anonymizeCircle
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
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 betweencurrentLatitude - offsetandcurrentLatitude + 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
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
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
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 betweencurrentLatitude - offsetandcurrentLatitude + offset- Returns:
- a reference of this object.
- Throws:
overit.geocall.asserts.AssertsException- if offset is negative.
-
anonymizeLatitude
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
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
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
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 betweencurrentlongitude - offsetandcurrentlongitude + offset- Returns:
- a reference of this object.
- Throws:
overit.geocall.asserts.AssertsException- if offset is negative.
-
anonymizeLongitude
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.
-