@@ -92,12 +92,12 @@ String colorSteno(String text)
92
92
// Let's make this a neat little state machine. Now if only it were fast...
93
93
StringBuilder sb = new StringBuilder ("<html>" );
94
94
int state = 0 ;
95
+ String s0 = "/#" ;
95
96
String s1 = "STPHKWR1234" ;
96
97
String s2 = "AO5" ;
97
98
String s3 = "*-0" ;
98
99
String s4 = "EU" ;
99
100
String s5 = "FPLTDRBGSZ6789" ;
100
- String ss = "/" ;
101
101
for (char c : text .toCharArray ()) {
102
102
switch (state ) {
103
103
case 0 : if (s1 .indexOf (c ) != -1 ) {
@@ -112,8 +112,8 @@ String colorSteno(String text)
112
112
} else if (s4 .indexOf (c ) != -1 ) {
113
113
state = 4 ;
114
114
sb .append (" <font color=\" white\" bgcolor=\" blue\" >" );
115
- } else {
116
- throw new IllegalArgumentException ( "Stroke with impossible values " );
115
+ } else if ( s0 . indexOf ( c ) != - 1 ) {
116
+ sb . append ( " " );
117
117
}
118
118
break ;
119
119
case 1 : if (s2 .indexOf (c ) != -1 ) {
@@ -125,7 +125,7 @@ String colorSteno(String text)
125
125
} else if (s4 .indexOf (c ) != -1 ) {
126
126
state = 4 ;
127
127
sb .append ("</font><font color=\" white\" bgcolor=\" blue\" >" );
128
- } else if (ss .indexOf (c ) != -1 ) {
128
+ } else if (s0 .indexOf (c ) != -1 ) {
129
129
state = 0 ;
130
130
sb .append ("</font> " );
131
131
}
@@ -139,7 +139,7 @@ String colorSteno(String text)
139
139
} else if (s5 .indexOf (c ) != -1 ) {
140
140
state = 5 ;
141
141
sb .append ("</font><font color=\" blue\" >" );
142
- } else if (ss .indexOf (c ) != -1 ) {
142
+ } else if (s0 .indexOf (c ) != -1 ) {
143
143
state = 0 ;
144
144
sb .append ("</font> " );
145
145
}
@@ -150,20 +150,20 @@ String colorSteno(String text)
150
150
} else if (s5 .indexOf (c ) != -1 ) {
151
151
state = 5 ;
152
152
sb .append ("<font color=\" blue\" >" );
153
- } else if (ss .indexOf (c ) != -1 ) {
153
+ } else if (s0 .indexOf (c ) != -1 ) {
154
154
state = 0 ;
155
155
sb .append (" " );
156
156
}
157
157
break ;
158
158
case 4 : if (s5 .indexOf (c ) != -1 ) {
159
159
state = 5 ;
160
160
sb .append ("</font><font color=\" blue\" >" );
161
- } else if (ss .indexOf (c ) != -1 ) {
161
+ } else if (s0 .indexOf (c ) != -1 ) {
162
162
state = 0 ;
163
163
sb .append ("</font> " );
164
164
}
165
165
break ;
166
- case 5 : if (ss .indexOf (c ) != -1 ) {
166
+ case 5 : if (s0 .indexOf (c ) != -1 ) {
167
167
state = 0 ;
168
168
sb .append ("</font> " );
169
169
}
0 commit comments