summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-08-05 13:40:17 -0400
committerKeith Packard <keithp@keithp.com>2010-08-05 13:40:17 -0400
commit85a670b5a904d6750d0f179ae307baeb8fc7cbd2 (patch)
treedb9213c4286956a1a039a15b7bef88f9d1787adf
parent9e8f7f75442303f9bfa99a0435984f5d36863ae6 (diff)
altosui: Explicitly initialize Altos class
Because the Altos class is never instantiated, the static initializers are never called, leaving the string to state mapping empty. Hand-code the call to the initialer instead. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/altosui/Altos.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/ao-tools/altosui/Altos.java b/ao-tools/altosui/Altos.java
index bda4080e..6ea7b43c 100644
--- a/ao-tools/altosui/Altos.java
+++ b/ao-tools/altosui/Altos.java
@@ -54,6 +54,10 @@ public class Altos {
static final int ao_flight_invalid = 9;
static HashMap<String,Integer> string_to_state = new HashMap<String,Integer>();
+
+ static boolean map_initialized = false;
+
+ static void initialize_map()
{
string_to_state.put("startup", ao_flight_startup);
string_to_state.put("idle", ao_flight_idle);
@@ -65,6 +69,7 @@ public class Altos {
string_to_state.put("main", ao_flight_main);
string_to_state.put("landed", ao_flight_landed);
string_to_state.put("invalid", ao_flight_invalid);
+ map_initialized = true;
}
static String[] state_to_string = {
@@ -81,6 +86,8 @@ public class Altos {
};
static public int state(String state) {
+ if (!map_initialized)
+ initialize_map();
if (string_to_state.containsKey(state))
return string_to_state.get(state);
return ao_flight_invalid;