Revision: 18446
          http://sourceforge.net/p/gate/code/18446
Author:   ian_roberts
Date:     2014-11-08 13:54:23 +0000 (Sat, 08 Nov 2014)
Log Message:
-----------
Treat integer-valued properties as Long rather than Integer by default (since 
GATE tends to support longs better than ints, e.g. in JAPE), unless they are 
too big for Long in which case use BigInteger.

Modified Paths:
--------------
    gate/trunk/plugins/Twitter/src/gate/corpora/twitter/TweetUtils.java

Modified: gate/trunk/plugins/Twitter/src/gate/corpora/twitter/TweetUtils.java
===================================================================
--- gate/trunk/plugins/Twitter/src/gate/corpora/twitter/TweetUtils.java 
2014-11-08 02:20:00 UTC (rev 18445)
+++ gate/trunk/plugins/Twitter/src/gate/corpora/twitter/TweetUtils.java 
2014-11-08 13:54:23 UTC (rev 18446)
@@ -124,11 +124,21 @@
     if (node.isBoolean()) {
       return node.asBoolean();
     }
-    if (node.isDouble()) {
-      return node.asDouble();
+    if (node.isIntegralNumber()) {
+      // use Long even if the number is representable as an Integer,
+      // since Long is better supported in JAPE etc.
+      if(node.canConvertToLong()) {
+        return node.asLong();
+      } else {
+        return node.bigIntegerValue();
+      }
     }
-    if (node.isInt()) {
-      return node.asInt();
+    if (node.isNumber()) {
+      // fractional number, as integers would have been caught by
+      // the previous test.  The numberValue will be a Double
+      // unless the parser was specifically configured to use
+      // BigDecimal instead
+      return node.numberValue();
     }
     if (node.isTextual()) {
       return node.asText();

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to