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 /** | 7 /** |
8 * Inserts the given arguments into [pattern]. | 8 * Inserts the given arguments into [pattern]. |
9 * | 9 * |
10 * format('Hello, {0}!', 'John') = 'Hello, John!' | 10 * format('Hello, {0}!', 'John') = 'Hello, John!' |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 final String name; | 130 final String name; |
131 | 131 |
132 /// The position in the enum declaration. | 132 /// The position in the enum declaration. |
133 final int ordinal; | 133 final int ordinal; |
134 const Enum(this.name, this.ordinal); | 134 const Enum(this.name, this.ordinal); |
135 int get hashCode => ordinal; | 135 int get hashCode => ordinal; |
136 int compareTo(E other) => ordinal - other.ordinal; | 136 int compareTo(E other) => ordinal - other.ordinal; |
137 String toString() => name; | 137 String toString() => name; |
138 } | 138 } |
139 | 139 |
140 class JavaArrays { | |
141 static int makeHashCode(List a) { | |
142 // TODO(rnystrom): This is not used by analyzer, but is called by | |
143 // analysis_server. Move this code there and remove it from here. | |
144 if (a == null) { | |
145 return 0; | |
146 } | |
147 int result = 1; | |
148 for (var element in a) { | |
149 result = 31 * result + (element == null ? 0 : element.hashCode); | |
150 } | |
151 return result; | |
152 } | |
153 } | |
154 | |
155 class JavaPatternMatcher { | 140 class JavaPatternMatcher { |
156 Iterator<Match> _matches; | 141 Iterator<Match> _matches; |
157 Match _match; | 142 Match _match; |
158 JavaPatternMatcher(RegExp re, String input) { | 143 JavaPatternMatcher(RegExp re, String input) { |
159 _matches = re.allMatches(input).iterator; | 144 _matches = re.allMatches(input).iterator; |
160 } | 145 } |
161 int end() => _match.end; | 146 int end() => _match.end; |
162 bool find() { | 147 bool find() { |
163 if (!_matches.moveNext()) { | 148 if (!_matches.moveNext()) { |
164 return false; | 149 return false; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 190 |
206 void printf(String fmt, List args) { | 191 void printf(String fmt, List args) { |
207 this.print(_printf(fmt, args)); | 192 this.print(_printf(fmt, args)); |
208 } | 193 } |
209 | 194 |
210 void println(String s) { | 195 void println(String s) { |
211 this.print(s); | 196 this.print(s); |
212 this.newLine(); | 197 this.newLine(); |
213 } | 198 } |
214 } | 199 } |
OLD | NEW |