Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: pkg/analyzer/lib/src/generated/java_core.dart

Issue 680863002: Remove JavaStringBuilder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 final Stopwatch nanoTimeStopwatch = new Stopwatch(); 5 final Stopwatch nanoTimeStopwatch = new Stopwatch();
6 6
7 const int LONG_MAX_VALUE = 0x7fffffffffffffff; 7 const int LONG_MAX_VALUE = 0x7fffffffffffffff;
8 8
9 class JavaSystem { 9 class JavaSystem {
10 static int currentTimeMillis() { 10 static int currentTimeMillis() {
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 459 }
460 460
461 bool javaBooleanAnd(bool a, bool b) { 461 bool javaBooleanAnd(bool a, bool b) {
462 return a && b; 462 return a && b;
463 } 463 }
464 464
465 int javaByte(Object o) { 465 int javaByte(Object o) {
466 return (o as int) & 0xFF; 466 return (o as int) & 0xFF;
467 } 467 }
468 468
469 class JavaStringBuilder {
470 StringBuffer sb = new StringBuffer();
471 String toString() => sb.toString();
472 JavaStringBuilder append(x) {
473 sb.write(x);
474 return this;
475 }
476 JavaStringBuilder appendChar(int c) {
477 sb.writeCharCode(c);
478 return this;
479 }
480 int get length => sb.length;
481 void set length(int newLength) {
482 if (newLength < 0) {
483 throw new StringIndexOutOfBoundsException(newLength);
484 }
485 if (sb.length < newLength) {
486 while (sb.length < newLength) {
487 sb.writeCharCode(0);
488 }
489 } else if (sb.length > newLength) {
490 var s = sb.toString().substring(0, newLength);
491 sb = new StringBuffer(s);
492 }
493 }
494 void clear() {
495 sb = new StringBuffer();
496 }
497 }
498
499 abstract class Enum<E extends Enum> implements Comparable<E> { 469 abstract class Enum<E extends Enum> implements Comparable<E> {
500 /// The name of this enum constant, as declared in the enum declaration. 470 /// The name of this enum constant, as declared in the enum declaration.
501 final String name; 471 final String name;
502 /// The position in the enum declaration. 472 /// The position in the enum declaration.
503 final int ordinal; 473 final int ordinal;
504 const Enum(this.name, this.ordinal); 474 const Enum(this.name, this.ordinal);
505 int get hashCode => ordinal; 475 int get hashCode => ordinal;
506 String toString() => name; 476 String toString() => name;
507 int compareTo(E other) => ordinal - other.ordinal; 477 int compareTo(E other) => ordinal - other.ordinal;
508 } 478 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 * format('{0} are you {1}ing?', ['What', 'read']) = 'What are you reading?' 516 * format('{0} are you {1}ing?', ['What', 'read']) = 'What are you reading?'
547 */ 517 */
548 String formatList(String pattern, List args) { 518 String formatList(String pattern, List args) {
549 return pattern.replaceAllMapped(new RegExp(r'\{(\d+)\}'), (match) { 519 return pattern.replaceAllMapped(new RegExp(r'\{(\d+)\}'), (match) {
550 String indexStr = match.group(1); 520 String indexStr = match.group(1);
551 int index = int.parse(indexStr); 521 int index = int.parse(indexStr);
552 var arg = args[index]; 522 var arg = args[index];
553 return arg != null ? arg.toString() : null; 523 return arg != null ? arg.toString() : null;
554 }); 524 });
555 } 525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698