Chromium Code Reviews| 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:uri"; | 4 import "dart:uri"; |
| 5 import "dart:collection" show ListBase; | 5 import "dart:collection" show ListBase; |
| 6 | 6 |
| 7 class JavaSystem { | 7 class JavaSystem { |
| 8 static int currentTimeMillis() { | 8 static int currentTimeMillis() { |
| 9 return (new DateTime.now()).millisecondsSinceEpoch; | 9 return (new DateTime.now()).millisecondsSinceEpoch; |
| 10 } | 10 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 String subSequence(int start, int end) => _content.substring(start, end); | 123 String subSequence(int start, int end) => _content.substring(start, end); |
| 124 } | 124 } |
| 125 | 125 |
| 126 class CharBuffer extends CharSequence { | 126 class CharBuffer extends CharSequence { |
| 127 CharBuffer(String content) : super(content); | 127 CharBuffer(String content) : super(content); |
| 128 static CharBuffer wrap(String content) => new CharBuffer(content); | 128 static CharBuffer wrap(String content) => new CharBuffer(content); |
| 129 } | 129 } |
| 130 | 130 |
| 131 class JavaString { | 131 class JavaString { |
| 132 static String format(String fmt, List args) { | 132 static String format(String fmt, List args) { |
| 133 return fmt; | 133 var index = 0; |
| 134 return fmt.replaceAllMapped(new RegExp(r'%(.)'), (match) { | |
| 135 switch (match.group(1)) { | |
| 136 case '%': return '%'; | |
| 137 case 's': | |
| 138 if (index >= args.length) { | |
| 139 throw new MissingFormatArgumentException(match.group(0)); | |
|
scheglov
2013/04/26 22:37:41
Do you want to copy declaration of this exception
nweiz
2013/04/26 23:13:37
Done.
| |
| 140 } | |
| 141 return args[index++].toString(); | |
| 142 default: return match.group(1); | |
| 143 } | |
| 144 }); | |
| 134 } | 145 } |
| 135 } | 146 } |
| 136 | 147 |
| 137 /** | 148 /** |
| 138 * Very limited printf implementation, supports only %s and %d. | 149 * Very limited printf implementation, supports only %s and %d. |
| 139 */ | 150 */ |
| 140 String _printf(String fmt, List args) { | 151 String _printf(String fmt, List args) { |
| 141 StringBuffer sb = new StringBuffer(); | 152 StringBuffer sb = new StringBuffer(); |
| 142 bool markFound = false; | 153 bool markFound = false; |
| 143 int argIndex = 0; | 154 int argIndex = 0; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 } | 468 } |
| 458 } else if (sb.length > newLength) { | 469 } else if (sb.length > newLength) { |
| 459 var s = sb.toString().substring(0, newLength); | 470 var s = sb.toString().substring(0, newLength); |
| 460 sb = new StringBuffer(s); | 471 sb = new StringBuffer(s); |
| 461 } | 472 } |
| 462 } | 473 } |
| 463 void clear() { | 474 void clear() { |
| 464 sb = new StringBuffer(); | 475 sb = new StringBuffer(); |
| 465 } | 476 } |
| 466 } | 477 } |
| OLD | NEW |