equal
deleted
inserted
replaced
37 */ |
37 */ |
38 public final |
38 public final |
39 class SwitchData { |
39 class SwitchData { |
40 int minValue, maxValue; |
40 int minValue, maxValue; |
41 Label defaultLabel = new Label(); |
41 Label defaultLabel = new Label(); |
42 Hashtable<Integer,Label> tab = new Hashtable<>(); |
42 Hashtable<Integer, Label> tab = new Hashtable<>(); |
43 // JCOV |
43 // JCOV |
44 Hashtable<Integer,Long> whereCaseTab = null; |
44 Hashtable<Integer, Long> whereCaseTab = null; |
45 // end JCOV |
45 // end JCOV |
46 |
46 |
47 /** |
47 /** |
48 * Get a label |
48 * Get a label |
49 */ |
49 */ |
90 return new SwitchDataEnumeration(tab); |
90 return new SwitchDataEnumeration(tab); |
91 } |
91 } |
92 |
92 |
93 // JCOV |
93 // JCOV |
94 public void initTableCase() { |
94 public void initTableCase() { |
95 whereCaseTab = new Hashtable<Integer,Long>(); |
95 whereCaseTab = new Hashtable<Integer, Long>(); |
96 } |
96 } |
97 public void addTableCase(int index, long where) { |
97 public void addTableCase(int index, long where) { |
98 if (whereCaseTab != null) |
98 if (whereCaseTab != null) |
99 whereCaseTab.put(Integer.valueOf(index), Long.valueOf(where)); |
99 whereCaseTab.put(Integer.valueOf(index), Long.valueOf(where)); |
100 } |
100 } |
101 // this puts String key into Hashtable<Integer,Long> |
101 // this puts String key into Hashtable<Integer, Long> |
102 @SuppressWarnings("unchecked") |
102 @SuppressWarnings("unchecked") |
103 public void addTableDefault(long where) { |
103 public void addTableDefault(long where) { |
104 if (whereCaseTab != null) |
104 if (whereCaseTab != null) |
105 ((Hashtable)whereCaseTab).put("default", Long.valueOf(where)); |
105 ((Hashtable)whereCaseTab).put("default", Long.valueOf(where)); |
106 } |
106 } |
121 /** |
121 /** |
122 * Create a new enumeration from the hashtable. Each key in the |
122 * Create a new enumeration from the hashtable. Each key in the |
123 * hash table will be an Integer, with the value being a label. The |
123 * hash table will be an Integer, with the value being a label. The |
124 * enumeration returns the keys in sorted order. |
124 * enumeration returns the keys in sorted order. |
125 */ |
125 */ |
126 SwitchDataEnumeration(Hashtable<Integer,Label> tab) { |
126 SwitchDataEnumeration(Hashtable<Integer, Label> tab) { |
127 table = new Integer[tab.size()]; |
127 table = new Integer[tab.size()]; |
128 int i = 0; |
128 int i = 0; |
129 for (Enumeration<Integer> e = tab.keys() ; e.hasMoreElements() ; ) { |
129 for (Enumeration<Integer> e = tab.keys() ; e.hasMoreElements() ; ) { |
130 table[i++] = e.nextElement(); |
130 table[i++] = e.nextElement(); |
131 } |
131 } |