| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.generated.java_core; | 5 library analyzer.src.generated.java_core; |
| 6 | 6 |
| 7 final Stopwatch nanoTimeStopwatch = new Stopwatch(); | |
| 8 | |
| 9 /** | 7 /** |
| 10 * Inserts the given arguments into [pattern]. | 8 * Inserts the given arguments into [pattern]. |
| 11 * | 9 * |
| 12 * format('Hello, {0}!', 'John') = 'Hello, John!' | 10 * format('Hello, {0}!', 'John') = 'Hello, John!' |
| 13 * format('{0} are you {1}ing?', 'How', 'do') = 'How are you doing?' | 11 * format('{0} are you {1}ing?', 'How', 'do') = 'How are you doing?' |
| 14 * format('{0} are you {1}ing?', 'What', 'read') = 'What are you reading?' | 12 * format('{0} are you {1}ing?', 'What', 'read') = 'What are you reading?' |
| 15 */ | 13 */ |
| 16 String format(String pattern, | 14 String format(String pattern, |
| 17 [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7]) { | 15 [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7]) { |
| 18 // TODO(rnystrom): This is not used by analyzer, but is called by | 16 // TODO(rnystrom): This is not used by analyzer, but is called by |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return target.indexOf(str, fromIndex); | 193 return target.indexOf(str, fromIndex); |
| 196 } | 194 } |
| 197 | 195 |
| 198 static int lastIndexOf(String target, String str, int fromIndex) { | 196 static int lastIndexOf(String target, String str, int fromIndex) { |
| 199 if (fromIndex > target.length) return -1; | 197 if (fromIndex > target.length) return -1; |
| 200 if (fromIndex < 0) fromIndex = 0; | 198 if (fromIndex < 0) fromIndex = 0; |
| 201 return target.lastIndexOf(str, fromIndex); | 199 return target.lastIndexOf(str, fromIndex); |
| 202 } | 200 } |
| 203 } | 201 } |
| 204 | 202 |
| 205 class JavaSystem { | |
| 206 static int currentTimeMillis() { | |
| 207 return (new DateTime.now()).millisecondsSinceEpoch; | |
| 208 } | |
| 209 | |
| 210 static int nanoTime() { | |
| 211 if (!nanoTimeStopwatch.isRunning) { | |
| 212 nanoTimeStopwatch.start(); | |
| 213 } | |
| 214 return nanoTimeStopwatch.elapsedMicroseconds * 1000; | |
| 215 } | |
| 216 } | |
| 217 | |
| 218 class PrintStringWriter extends PrintWriter { | 203 class PrintStringWriter extends PrintWriter { |
| 219 final StringBuffer _sb = new StringBuffer(); | 204 final StringBuffer _sb = new StringBuffer(); |
| 220 | 205 |
| 221 void print(x) { | 206 void print(x) { |
| 222 _sb.write(x); | 207 _sb.write(x); |
| 223 } | 208 } |
| 224 | 209 |
| 225 String toString() => _sb.toString(); | 210 String toString() => _sb.toString(); |
| 226 } | 211 } |
| 227 | 212 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 240 this.print(s); | 225 this.print(s); |
| 241 this.newLine(); | 226 this.newLine(); |
| 242 } | 227 } |
| 243 } | 228 } |
| 244 | 229 |
| 245 class URISyntaxException implements Exception { | 230 class URISyntaxException implements Exception { |
| 246 final String message; | 231 final String message; |
| 247 URISyntaxException(this.message); | 232 URISyntaxException(this.message); |
| 248 String toString() => "URISyntaxException: $message"; | 233 String toString() => "URISyntaxException: $message"; |
| 249 } | 234 } |
| OLD | NEW |