Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * Provide a list of Unicode codepoints for a given string. | 6 * Provide a list of Unicode codepoints for a given string. |
| 7 */ | 7 */ |
| 8 List<int> stringToCodepoints(String str) { | 8 List<int> stringToCodepoints(String str) { |
| 9 List<int> codepoints; | 9 List<int> codepoints; |
| 10 // TODO _is16BitCodeUnit() is used to work around a bug with dart2js | 10 // TODO _is16BitCodeUnit() is used to work around a bug with dart2js |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 new _ListRangeIteratorImpl(_source, _offset, _offset + _length); | 233 new _ListRangeIteratorImpl(_source, _offset, _offset + _length); |
| 234 | 234 |
| 235 int get length => _length; | 235 int get length => _length; |
| 236 } | 236 } |
| 237 | 237 |
| 238 /** | 238 /** |
| 239 * The _ListRangeIterator provides more capabilities than a standard iterator, | 239 * The _ListRangeIterator provides more capabilities than a standard iterator, |
| 240 * including the ability to get the current position, count remaining items, | 240 * including the ability to get the current position, count remaining items, |
| 241 * and move forward/backward within the iterator. | 241 * and move forward/backward within the iterator. |
| 242 */ | 242 */ |
| 243 interface _ListRangeIterator extends Iterator<int> { | 243 abstract class _ListRangeIterator extends Iterator<int> { |
|
ngeoffray
2012/09/12 10:41:47
Should that be implements?
bakster
2012/09/12 10:45:49
Done.
| |
| 244 bool hasNext(); | 244 bool hasNext(); |
| 245 int next(); | 245 int next(); |
| 246 int get position; | 246 int get position; |
| 247 void backup([by]); | 247 void backup([by]); |
| 248 int get remaining; | 248 int get remaining; |
| 249 void skip([count]); | 249 void skip([count]); |
| 250 } | 250 } |
| 251 | 251 |
| 252 class _ListRangeIteratorImpl implements _ListRangeIterator { | 252 class _ListRangeIteratorImpl implements _ListRangeIterator { |
| 253 final List<int> _source; | 253 final List<int> _source; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 266 _offset -= by; | 266 _offset -= by; |
| 267 } | 267 } |
| 268 | 268 |
| 269 int get remaining => _end - _offset; | 269 int get remaining => _end - _offset; |
| 270 | 270 |
| 271 void skip([int count = 1]) { | 271 void skip([int count = 1]) { |
| 272 _offset += count; | 272 _offset += count; |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| OLD | NEW |