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

Side by Side Diff: editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart

Issue 16103010: Fixes for translator and DDA status files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months 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
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 result = 31 * result + (element == null ? 0 : element.hashCode); 77 result = 31 * result + (element == null ? 0 : element.hashCode);
78 } 78 }
79 return result; 79 return result;
80 } 80 }
81 static List asList(List list) => list; 81 static List asList(List list) => list;
82 } 82 }
83 83
84 class Character { 84 class Character {
85 static const int MAX_VALUE = 0xffff; 85 static const int MAX_VALUE = 0xffff;
86 static const int MAX_CODE_POINT = 0x10ffff; 86 static const int MAX_CODE_POINT = 0x10ffff;
87 static const int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000;
88 static const int MIN_LOW_SURROGATE = 0xDC00;
89 static const int MIN_HIGH_SURROGATE = 0xD800;
87 static bool isLetter(int c) { 90 static bool isLetter(int c) {
88 return c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A; 91 return c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A;
89 } 92 }
90 static bool isLetterOrDigit(int c) { 93 static bool isLetterOrDigit(int c) {
91 return isLetter(c) || c >= 0x30 && c <= 0x39; 94 return isLetter(c) || c >= 0x30 && c <= 0x39;
92 } 95 }
93 static bool isWhitespace(int c) { 96 static bool isWhitespace(int c) {
94 return c == 0x09 || c == 0x20 || c == 0x0A || c == 0x0D; 97 return c == 0x09 || c == 0x20 || c == 0x0A || c == 0x0D;
95 } 98 }
96 static int digit(int codePoint, int radix) { 99 static int digit(int codePoint, int radix) {
97 if (radix != 16) { 100 if (radix != 16) {
98 throw new ArgumentError("only radix == 16 is supported"); 101 throw new ArgumentError("only radix == 16 is supported");
99 } 102 }
100 if (0x30 <= codePoint && codePoint <= 0x39) { 103 if (0x30 <= codePoint && codePoint <= 0x39) {
101 return codePoint - 0x30; 104 return codePoint - 0x30;
102 } 105 }
103 if (0x41 <= codePoint && codePoint <= 0x46) { 106 if (0x41 <= codePoint && codePoint <= 0x46) {
104 return 0xA + (codePoint - 0x41); 107 return 0xA + (codePoint - 0x41);
105 } 108 }
106 if (0x61 <= codePoint && codePoint <= 0x66) { 109 if (0x61 <= codePoint && codePoint <= 0x66) {
107 return 0xA + (codePoint - 0x61); 110 return 0xA + (codePoint - 0x61);
108 } 111 }
109 return -1; 112 return -1;
110 } 113 }
111 static String toChars(int codePoint) { 114 static String toChars(int codePoint) {
112 throw new UnsupportedOperationException(); 115 if (codePoint < 0 || codePoint > MAX_CODE_POINT) {
116 throw new IllegalArgumentException();
117 }
118 if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
119 return new String.fromCharCode(codePoint);
120 }
121 int offset = codePoint - MIN_SUPPLEMENTARY_CODE_POINT;
122 int c0 = ((offset & 0x7FFFFFFF) >> 10) + MIN_HIGH_SURROGATE;
123 int c1 = (offset & 0x3ff) + MIN_LOW_SURROGATE;
124 return new String.fromCharCodes([c0, c1]);
113 } 125 }
114 } 126 }
115 127
116 class CharSequence { 128 class CharSequence {
117 final String _content; 129 final String _content;
118 CharSequence(this._content); 130 CharSequence(this._content);
119 static CharSequence wrap(String content) => new CharBuffer(content); 131 static CharSequence wrap(String content) => new CharBuffer(content);
120 int charAt(int index) => _content.codeUnitAt(index); 132 int charAt(int index) => _content.codeUnitAt(index);
121 int length() => _content.length; 133 int length() => _content.length;
122 String subSequence(int start, int end) => _content.substring(start, end); 134 String subSequence(int start, int end) => _content.substring(start, end);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 508 }
497 } else if (sb.length > newLength) { 509 } else if (sb.length > newLength) {
498 var s = sb.toString().substring(0, newLength); 510 var s = sb.toString().substring(0, newLength);
499 sb = new StringBuffer(s); 511 sb = new StringBuffer(s);
500 } 512 }
501 } 513 }
502 void clear() { 514 void clear() {
503 sb = new StringBuffer(); 515 sb = new StringBuffer();
504 } 516 }
505 } 517 }
OLDNEW
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698