altosuilib: Track open frames, exit when none remain
[fw/altos] / altoslib / AltosParse.java
index de79c2fb16a7b6dbb9703c29ca72ca4d804bdd86..fbd049ae7a3da093c89de7ea5345546a4d3b8bf5 100644 (file)
@@ -15,7 +15,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_7;
+package org.altusmetrum.altoslib_11;
 
 import java.util.*;
 import java.text.*;
@@ -26,6 +26,14 @@ public class AltosParse {
        }
 
        public static int parse_int(String v) throws ParseException {
+               try {
+                       return (int) AltosLib.fromdec(v);
+               } catch (NumberFormatException e) {
+                       throw new ParseException("error parsing int " + v, 0);
+               }
+       }
+
+       public static long parse_long(String v) throws ParseException {
                try {
                        return AltosLib.fromdec(v);
                } catch (NumberFormatException e) {
@@ -53,6 +61,10 @@ public class AltosParse {
                }
        }
 
+       public static String format_double_locale(double number) {
+               return nf_locale.format(number);
+       }
+
        public static double parse_double_net(String str) throws ParseException {
                try {
                        return nf_net.parse(str.trim()).doubleValue();
@@ -61,6 +73,10 @@ public class AltosParse {
                }
        }
 
+       public static String format_double_net(double number) {
+               return nf_net.format(number);
+       }
+
        public static double parse_coord(String coord) throws ParseException {
                String[]        dsf = coord.split("\\D+");