| OLD | NEW |
| 1 library java.core; | 1 library java.core; |
| 2 | 2 |
| 3 import "dart:math" as math; | 3 import "dart:math" as math; |
| 4 import "dart:collection" show ListBase; | 4 import "dart:collection" show ListBase; |
| 5 | 5 |
| 6 class JavaSystem { | 6 class JavaSystem { |
| 7 static int currentTimeMillis() { | 7 static int currentTimeMillis() { |
| 8 return (new DateTime.now()).millisecondsSinceEpoch; | 8 return (new DateTime.now()).millisecondsSinceEpoch; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 case '%': return '%'; | 147 case '%': return '%'; |
| 148 case 's': | 148 case 's': |
| 149 if (index >= args.length) { | 149 if (index >= args.length) { |
| 150 throw new MissingFormatArgumentException(match.group(0)); | 150 throw new MissingFormatArgumentException(match.group(0)); |
| 151 } | 151 } |
| 152 return args[index++].toString(); | 152 return args[index++].toString(); |
| 153 default: return match.group(1); | 153 default: return match.group(1); |
| 154 } | 154 } |
| 155 }); | 155 }); |
| 156 } | 156 } |
| 157 static int indexOf(String target, String str, int fromIndex) { |
| 158 if (fromIndex > target.length) return -1; |
| 159 if (fromIndex < 0) fromIndex = 0; |
| 160 return target.indexOf(str, fromIndex); |
| 161 } |
| 162 static int lastIndexOf(String target, String str, int fromIndex) { |
| 163 if (fromIndex > target.length) return -1; |
| 164 if (fromIndex < 0) fromIndex = 0; |
| 165 return target.lastIndexOf(str, fromIndex); |
| 166 } |
| 157 static bool startsWithBefore(String s, String other, int start) { | 167 static bool startsWithBefore(String s, String other, int start) { |
| 158 return s.indexOf(other, start) != -1; | 168 return s.indexOf(other, start) != -1; |
| 159 } | 169 } |
| 160 } | 170 } |
| 161 | 171 |
| 162 /** | 172 /** |
| 163 * Very limited printf implementation, supports only %s and %d. | 173 * Very limited printf implementation, supports only %s and %d. |
| 164 */ | 174 */ |
| 165 String _printf(String fmt, List args) { | 175 String _printf(String fmt, List args) { |
| 166 StringBuffer sb = new StringBuffer(); | 176 StringBuffer sb = new StringBuffer(); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 514 } |
| 505 } else if (sb.length > newLength) { | 515 } else if (sb.length > newLength) { |
| 506 var s = sb.toString().substring(0, newLength); | 516 var s = sb.toString().substring(0, newLength); |
| 507 sb = new StringBuffer(s); | 517 sb = new StringBuffer(s); |
| 508 } | 518 } |
| 509 } | 519 } |
| 510 void clear() { | 520 void clear() { |
| 511 sb = new StringBuffer(); | 521 sb = new StringBuffer(); |
| 512 } | 522 } |
| 513 } | 523 } |
| OLD | NEW |