diff --git a/src/main/java/org/caosdb/server/query/POV.java b/src/main/java/org/caosdb/server/query/POV.java index b030e0f4bb3accf31e6dd3bff23c3ce1f2aca948..c64d522ac438b8a65941d1ed45220887a7ab28ca 100644 --- a/src/main/java/org/caosdb/server/query/POV.java +++ b/src/main/java/org/caosdb/server/query/POV.java @@ -134,8 +134,7 @@ public class POV implements EntityFilterInterface { } else { try { // Doubles are allowed without dots, for example when the integer overflows. - // final Pattern dp = Pattern.compile("^(-?[0-9]+(?:\\.)?(?:[0-9]+))\\s*([^-]*)$"); - final Pattern dp = Pattern.compile("^(-?[0-9]+(?:\\.[0-9]+))\\s*([^-]*)$"); + final Pattern dp = Pattern.compile("^(-?[0-9]+(?:\\.)?(?:[0-9]+))\\s*([^-]*)$"); final Matcher m = dp.matcher(value); if (!m.matches()) { throw new NumberFormatException(); @@ -144,9 +143,6 @@ public class POV implements EntityFilterInterface { unitStr = m.group(2); this.vDouble = Double.parseDouble(vDoubleStr); - if (this.vDouble % 1 == 0) { - this.vInt = (int) Math.floor(this.vDouble); - } } catch (final NumberFormatException e) { this.vDouble = null; } @@ -507,35 +503,35 @@ public class POV implements EntityFilterInterface { return ret; } - /** Return the value type as string, for debugging purposes. */ - // public String getValueType() { - // if (this.vInt != null) { // vInt - // System.out.println(this.vInt); - // return "Integer"; - // } - // if (this.vDouble != null) { // vInt - // return "Double"; - // } - // if (this.vDatetime != null) { // vInt - // return "Datetime"; - // } - // return "String"; - // } - - // /** Return the Int value, which may be null. */ - // public Integer getVInt() { - // return this.vInt; - // } - - // /** Return the Double value, which may be null. */ - // public Double getVDouble() { - // return this.vDouble; - // } - - // /** Return the Datetime value, which may be null. */ - // public DateTimeInterface getVDatetime() { - // return this.vDatetime; - // } + /** Return the value type as string, for debugging puposes. */ + public String getValueType() { + if (this.vInt != null) { // vInt + System.out.println(this.vInt); + return "Integer"; + } + if (this.vDouble != null) { // vInt + return "Double"; + } + if (this.vDatetime != null) { // vInt + return "Datetime"; + } + return "String"; + } + + /** Return the Int value, which may be null. */ + public Integer getVInt() { + return this.vInt; + } + + /** Return the Double value, which may be null. */ + public Double getVDouble() { + return this.vDouble; + } + + /** Return the Datetime value, which may be null. */ + public DateTimeInterface getVDatetime() { + return this.vDatetime; + } public String getAggregate() { return this.aggregate; diff --git a/src/test/java/org/caosdb/server/query/TestCQL.java b/src/test/java/org/caosdb/server/query/TestCQL.java index c600fc32880e6255050d54cb02992d9ea2819ce0..a4b08515d9e048a218eded199a498414dc6aa027 100644 --- a/src/test/java/org/caosdb/server/query/TestCQL.java +++ b/src/test/java/org/caosdb/server/query/TestCQL.java @@ -6930,7 +6930,7 @@ public class TestCQL { POV pov = ((POV) sfq.filter); System.out.println(pov.getValue()); assertEquals("10000000000", pov.getValue()); - // assertEquals("Double", pov.getValueType()); - // assertEquals(1e10, pov.getVDouble().doubleValue(), 0.0); + assertEquals("Double", pov.getValueType()); + assertEquals(1e10, pov.getVDouble().doubleValue(), 0.0); } }