| OLD | NEW |
| 1 library java.engine; | 1 library java.engine; |
| 2 | 2 |
| 3 import 'java_core.dart'; | 3 import 'java_core.dart'; |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A predicate is a one-argument function that returns a boolean value. | 6 * A predicate is a one-argument function that returns a boolean value. |
| 7 */ | 7 */ |
| 8 typedef bool Predicate<E>(E argument); | 8 typedef bool Predicate<E>(E argument); |
| 9 | 9 |
| 10 class StringUtilities { | 10 class StringUtilities { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 int last = string.length; | 151 int last = string.length; |
| 152 while (index < last) { | 152 while (index < last) { |
| 153 int c = string.codeUnitAt(index); | 153 int c = string.codeUnitAt(index); |
| 154 if (!Character.isLetterOrDigit(c)) { | 154 if (!Character.isLetterOrDigit(c)) { |
| 155 return index; | 155 return index; |
| 156 } | 156 } |
| 157 index++; | 157 index++; |
| 158 } | 158 } |
| 159 return last; | 159 return last; |
| 160 } | 160 } |
| 161 |
| 162 /** |
| 163 * Produce a string containing all of the names in the given array, surrounded
by single quotes, |
| 164 * and separated by commas. The list must contain at least two elements. |
| 165 * |
| 166 * @param names the names to be printed |
| 167 * @return the result of printing the names |
| 168 */ |
| 169 static String printListOfQuotedNames(List<String> names) { |
| 170 if (names == null) { |
| 171 throw new IllegalArgumentException("The list must not be null"); |
| 172 } |
| 173 int count = names.length; |
| 174 if (count < 2) { |
| 175 throw new IllegalArgumentException("The list must contain at least two nam
es"); |
| 176 } |
| 177 StringBuffer buffer = new StringBuffer(); |
| 178 buffer.write("'"); |
| 179 buffer.write(names[0]); |
| 180 buffer.write("'"); |
| 181 for (int i = 1; i < count - 1; i++) { |
| 182 buffer.write(", '"); |
| 183 buffer.write(names[i]); |
| 184 buffer.write("'"); |
| 185 } |
| 186 buffer.write(" and '"); |
| 187 buffer.write(names[count - 1]); |
| 188 buffer.write("'"); |
| 189 return buffer.toString(); |
| 190 } |
| 161 } | 191 } |
| 162 | 192 |
| 163 class FileNameUtilities { | 193 class FileNameUtilities { |
| 164 static String getExtension(String fileName) { | 194 static String getExtension(String fileName) { |
| 165 if (fileName == null) { | 195 if (fileName == null) { |
| 166 return ""; | 196 return ""; |
| 167 } | 197 } |
| 168 int index = fileName.lastIndexOf('.'); | 198 int index = fileName.lastIndexOf('.'); |
| 169 if (index >= 0) { | 199 if (index >= 0) { |
| 170 return fileName.substring(index + 1); | 200 return fileName.substring(index + 1); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (cause != null) { | 310 if (cause != null) { |
| 281 buffer.write('Caused by '); | 311 buffer.write('Caused by '); |
| 282 cause._writeOn(buffer); | 312 cause._writeOn(buffer); |
| 283 } | 313 } |
| 284 } else { | 314 } else { |
| 285 buffer.writeln(exception.toString()); | 315 buffer.writeln(exception.toString()); |
| 286 buffer.writeln(stackTrace.toString()); | 316 buffer.writeln(stackTrace.toString()); |
| 287 } | 317 } |
| 288 } | 318 } |
| 289 } | 319 } |
| OLD | NEW |