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 | 4 |
5 class JavaSystem { | 5 class JavaSystem { |
6 static int currentTimeMillis() { | 6 static int currentTimeMillis() { |
7 return (new DateTime.now()).millisecondsSinceEpoch; | 7 return (new DateTime.now()).millisecondsSinceEpoch; |
8 } | 8 } |
9 | 9 |
10 static void arraycopy(List src, int srcPos, List dest, int destPos, int length
) { | 10 static void arraycopy(List src, int srcPos, List dest, int destPos, int length
) { |
(...skipping 22 matching lines...) Expand all Loading... |
33 if (oTypeName.startsWith("List") && tTypeName == "List") { | 33 if (oTypeName.startsWith("List") && tTypeName == "List") { |
34 return true; | 34 return true; |
35 } | 35 } |
36 if (tTypeName == "Map" && o is Map) { | 36 if (tTypeName == "Map" && o is Map) { |
37 return true; | 37 return true; |
38 } | 38 } |
39 // Dart Analysis Engine specific | 39 // Dart Analysis Engine specific |
40 if (oTypeName == "${tTypeName}Impl") { | 40 if (oTypeName == "${tTypeName}Impl") { |
41 return true; | 41 return true; |
42 } | 42 } |
| 43 if (tTypeName == "FormalParameter") { |
| 44 return |
| 45 oTypeName == "DefaultFormalParameter" || |
| 46 oTypeName == "FieldNormalParameter" || |
| 47 oTypeName == "FunctionTypedFormalParameter" || |
| 48 oTypeName == "SimpleFormalParameter"; |
| 49 } |
43 if (tTypeName == "MethodElement") { | 50 if (tTypeName == "MethodElement") { |
44 if (oTypeName == "MethodMember") { | 51 if (oTypeName == "MethodMember") { |
45 return true; | 52 return true; |
46 } | 53 } |
47 } | 54 } |
48 if (tTypeName == "ExecutableElement") { | 55 if (tTypeName == "ExecutableElement") { |
49 if (oTypeName == "MethodElementImpl" || | 56 if (oTypeName == "MethodElementImpl" || |
50 oTypeName == "FunctionElementImpl" || | 57 oTypeName == "FunctionElementImpl" || |
51 oTypeName == "PropertyAccessorElementImpl") { | 58 oTypeName == "PropertyAccessorElementImpl") { |
52 return true; | 59 return true; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return sb.toString(); | 272 return sb.toString(); |
266 } | 273 } |
267 } | 274 } |
268 | 275 |
269 class Math { | 276 class Math { |
270 static num max(num a, num b) => math.max(a, b); | 277 static num max(num a, num b) => math.max(a, b); |
271 static num min(num a, num b) => math.min(a, b); | 278 static num min(num a, num b) => math.min(a, b); |
272 } | 279 } |
273 | 280 |
274 class RuntimeException extends JavaException { | 281 class RuntimeException extends JavaException { |
275 RuntimeException([String message = "", Exception cause = null]) : | 282 RuntimeException({String message: "", Exception cause: null}) : |
276 super(message, cause); | 283 super(message, cause); |
277 } | 284 } |
278 | 285 |
279 class JavaException implements Exception { | 286 class JavaException implements Exception { |
280 final String message; | 287 final String message; |
281 final Exception cause; | 288 final Exception cause; |
282 JavaException([this.message = "", this.cause = null]); | 289 JavaException([this.message = "", this.cause = null]); |
283 JavaException.withCause(this.cause) : message = null; | 290 JavaException.withCause(this.cause) : message = null; |
284 String toString() => "${runtimeType}: $message $cause"; | 291 String toString() => "${runtimeType}: $message $cause"; |
285 } | 292 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 var oend = ooffset + len; | 436 var oend = ooffset + len; |
430 if (tend > t.length) return false; | 437 if (tend > t.length) return false; |
431 if (oend > o.length) return false; | 438 if (oend > o.length) return false; |
432 return t.substring(toffset, tend) == o.substring(ooffset, oend); | 439 return t.substring(toffset, tend) == o.substring(ooffset, oend); |
433 } | 440 } |
434 | 441 |
435 bool javaBooleanOr(bool a, bool b) { | 442 bool javaBooleanOr(bool a, bool b) { |
436 return a || b; | 443 return a || b; |
437 } | 444 } |
438 | 445 |
| 446 bool javaBooleanAnd(bool a, bool b) { |
| 447 return a && b; |
| 448 } |
| 449 |
439 class JavaStringBuilder { | 450 class JavaStringBuilder { |
440 StringBuffer sb = new StringBuffer(); | 451 StringBuffer sb = new StringBuffer(); |
441 String toString() => sb.toString(); | 452 String toString() => sb.toString(); |
442 JavaStringBuilder append(x) { | 453 JavaStringBuilder append(x) { |
443 sb.write(x); | 454 sb.write(x); |
444 return this; | 455 return this; |
445 } | 456 } |
446 JavaStringBuilder appendChar(int c) { | 457 JavaStringBuilder appendChar(int c) { |
447 sb.writeCharCode(c); | 458 sb.writeCharCode(c); |
448 return this; | 459 return this; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 if (!_matches.moveNext()) { | 498 if (!_matches.moveNext()) { |
488 return false; | 499 return false; |
489 } | 500 } |
490 _match = _matches.current; | 501 _match = _matches.current; |
491 return true; | 502 return true; |
492 } | 503 } |
493 String group(int i) => _match[i]; | 504 String group(int i) => _match[i]; |
494 int start() => _match.start; | 505 int start() => _match.start; |
495 int end() => _match.end; | 506 int end() => _match.end; |
496 } | 507 } |
OLD | NEW |