// Path: ngsi2-client/src/main/java/com/orange/ngsi2/exception/InvalidatedSyntaxException.java
// public class InvalidatedSyntaxException extends Ngsi2Exception {
// 
//     private final static String message = "The incoming request is invalid in this context. %s has a bad syntax.";
// 
//     public InvalidatedSyntaxException(Error error) {
//         super(error);
//     }
// 
//     public InvalidatedSyntaxException(String field) {
//         super("400", String.format(message, field), null);
//     }
// 
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/exception/NotAcceptableException.java
// public class NotAcceptableException extends Ngsi2Exception {
// 
//     private final static String message = "Not Acceptable: Accepted MIME types: text/plain.";
// 
//     public NotAcceptableException() {
//         super("406", message, null);
//     }
// 
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/model/Coordinate.java
// public class Coordinate {
// 
//     double latitude;
// 
//     double longitude;
// 
//     public Coordinate(double latitude, double longitude) {
//         this.latitude = latitude;
//         this.longitude = longitude;
//     }
// 
//     public double getLatitude() {
//         return latitude;
//     }
// 
//     public void setLatitude(double latitude) {
//         this.latitude = latitude;
//     }
// 
//     public double getLongitude() {
//         return longitude;
//     }
// 
//     public void setLongitude(double longitude) {
//         this.longitude = longitude;
//     }
// 
//     @Override
//     public String toString() {
//         return latitude + "," + longitude ;
//     }
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/model/GeoQuery.java
// public class GeoQuery {
// 
//     /**
//      * GeoQuery Enum model
//      */
//     public enum Relation {
//         near, coveredBy, intersects, equals, disjoint
//     }
// 
//     /**
//      * Modifier Enum model
//      */
//     public enum Modifier {
//         maxDistance, minDistance
//     }
// 
//     /**
//      * Geometry enum used for entities querying
//      */
//     public enum Geometry {
//         point, line, polygon, box
//     }
// 
//     private final Relation relation;
// 
//     private final Geometry geometry;
// 
//     private final List<Coordinate> coordinates;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final Modifier modifier;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final float distance;
// 
//     /**
//      * Default constructor
//      * @param relation relation to the geometry
//      * @param geometry geometry to match
//      * @param coordinates coordinates for the geometry
//      */
//     public GeoQuery(Relation relation, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = relation;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//         this.modifier = null;
//         this.distance = 0;
//     }
// 
//     /**
//      * Defines a near relation with modifier and distance
//      * @param modifier
//      * @param distance
//      */
//     public GeoQuery(Modifier modifier, float distance, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = Relation.near;
//         this.modifier = modifier;
//         this.distance = distance;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//     }
// 
//     public Relation getRelation() {
//         return relation;
//     }
// 
//     public Modifier getModifier() {
//         return modifier;
//     }
// 
//     public float getDistance() {
//         return distance;
//     }
// 
//     public Geometry getGeometry() {
//         return geometry;
//     }
// 
//     public List<Coordinate> getCoordinates() {
//         return coordinates;
//     }
// }


import com.orange.ngsi2.exception.InvalidatedSyntaxException;
import com.orange.ngsi2.exception.NotAcceptableException;
import com.orange.ngsi2.model.Coordinate;
import com.orange.ngsi2.model.GeoQuery;
import java.util.ArrayList;
import java.util.List;
        // Attempt to parse as the simplest number format possible...
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException ignored) {}
        try {
            return Long.parseLong(value);
        } catch (NumberFormatException ignored) {}
        try {
            return Float.parseFloat(value);
        } catch (NumberFormatException ignored) {}
        try {
            return Double.parseDouble(value);
        } catch (NumberFormatException ignored) {}
        throw new NotAcceptableException();
    }

    /**
     * Parse a GeoQuery request parameters
     * @param georel the georel parameter
     * @param geometry the geometry parameter
     * @param coords the coords parameter
     * @return a GeoQuery
     * @throws InvalidatedSyntaxException on error
     */
    public static GeoQuery parseGeoQuery(String georel, String geometry, String coords) {
        String[] georelFields = georel.split(";");
        GeoQuery.Relation relation;
        try {
            relation = GeoQuery.Relation.valueOf(georelFields[0]);
        } catch (IllegalArgumentException e) {
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/exception/InvalidatedSyntaxException.java
// public class InvalidatedSyntaxException extends Ngsi2Exception {
// 
//     private final static String message = "The incoming request is invalid in this context. %s has a bad syntax.";
// 
//     public InvalidatedSyntaxException(Error error) {
//         super(error);
//     }
// 
//     public InvalidatedSyntaxException(String field) {
//         super("400", String.format(message, field), null);
//     }
// 
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/exception/NotAcceptableException.java
// public class NotAcceptableException extends Ngsi2Exception {
// 
//     private final static String message = "Not Acceptable: Accepted MIME types: text/plain.";
// 
//     public NotAcceptableException() {
//         super("406", message, null);
//     }
// 
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/model/Coordinate.java
// public class Coordinate {
// 
//     double latitude;
// 
//     double longitude;
// 
//     public Coordinate(double latitude, double longitude) {
//         this.latitude = latitude;
//         this.longitude = longitude;
//     }
// 
//     public double getLatitude() {
//         return latitude;
//     }
// 
//     public void setLatitude(double latitude) {
//         this.latitude = latitude;
//     }
// 
//     public double getLongitude() {
//         return longitude;
//     }
// 
//     public void setLongitude(double longitude) {
//         this.longitude = longitude;
//     }
// 
//     @Override
//     public String toString() {
//         return latitude + "," + longitude ;
//     }
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/model/GeoQuery.java
// public class GeoQuery {
// 
//     /**
//      * GeoQuery Enum model
//      */
//     public enum Relation {
//         near, coveredBy, intersects, equals, disjoint
//     }
// 
//     /**
//      * Modifier Enum model
//      */
//     public enum Modifier {
//         maxDistance, minDistance
//     }
// 
//     /**
//      * Geometry enum used for entities querying
//      */
//     public enum Geometry {
//         point, line, polygon, box
//     }
// 
//     private final Relation relation;
// 
//     private final Geometry geometry;
// 
//     private final List<Coordinate> coordinates;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final Modifier modifier;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final float distance;
// 
//     /**
//      * Default constructor
//      * @param relation relation to the geometry
//      * @param geometry geometry to match
//      * @param coordinates coordinates for the geometry
//      */
//     public GeoQuery(Relation relation, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = relation;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//         this.modifier = null;
//         this.distance = 0;
//     }
// 
//     /**
//      * Defines a near relation with modifier and distance
//      * @param modifier
//      * @param distance
//      */
//     public GeoQuery(Modifier modifier, float distance, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = Relation.near;
//         this.modifier = modifier;
//         this.distance = distance;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//     }
// 
//     public Relation getRelation() {
//         return relation;
//     }
// 
//     public Modifier getModifier() {
//         return modifier;
//     }
// 
//     public float getDistance() {
//         return distance;
//     }
// 
//     public Geometry getGeometry() {
//         return geometry;
//     }
// 
//     public List<Coordinate> getCoordinates() {
//         return coordinates;
//     }
// }


// Path: ngsi2-server/src/main/java/com/orange/ngsi2/server/Ngsi2ParsingHelper.java
import com.orange.ngsi2.exception.InvalidatedSyntaxException;
import com.orange.ngsi2.exception.NotAcceptableException;
import com.orange.ngsi2.model.Coordinate;
import com.orange.ngsi2.model.GeoQuery;
import java.util.ArrayList;
import java.util.List;

        // Attempt to parse as the simplest number format possible...
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException ignored) {}
        try {
            return Long.parseLong(value);
        } catch (NumberFormatException ignored) {}
        try {
            return Float.parseFloat(value);
        } catch (NumberFormatException ignored) {}
        try {
            return Double.parseDouble(value);
        } catch (NumberFormatException ignored) {}
        throw new NotAcceptableException();
    }

    /**
     * Parse a GeoQuery request parameters
     * @param georel the georel parameter
     * @param geometry the geometry parameter
     * @param coords the coords parameter
     * @return a GeoQuery
     * @throws InvalidatedSyntaxException on error
     */
    public static GeoQuery parseGeoQuery(String georel, String geometry, String coords) {
        String[] georelFields = georel.split(";");
        GeoQuery.Relation relation;
        try {
            relation = GeoQuery.Relation.valueOf(georelFields[0]);
        } catch (IllegalArgumentException e) {
            throw new InvalidatedSyntaxException(georelFields[0]);