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

Unified Diff: pkg/utf/lib/list_range.dart

Issue 418433003: pkg/utf: fixed layout, added todos, updated docs and homepage pubspec links (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/utf/lib/constants.dart ('k') | pkg/utf/lib/src/constants.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/utf/lib/list_range.dart
diff --git a/pkg/utf/lib/list_range.dart b/pkg/utf/lib/list_range.dart
deleted file mode 100644
index 06adb76c6416e7064d047d2a7af18cf77b785124..0000000000000000000000000000000000000000
--- a/pkg/utf/lib/list_range.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of utf;
-
-/**
- * _ListRange in an internal type used to create a lightweight Interable on a
- * range within a source list. DO NOT MODIFY the underlying list while
- * iterating over it. The results of doing so are undefined.
- */
-// TODO(floitsch): Consider removing the extend and switch to implements since
-// that's cheaper to allocate.
-class _ListRange extends IterableBase {
- final List _source;
- final int _offset;
- final int _length;
-
- _ListRange(source, [offset = 0, length]) :
- this._source = source,
- this._offset = offset,
- this._length = (length == null ? source.length - offset : length) {
- if (_offset < 0 || _offset > _source.length) {
- throw new RangeError.value(_offset);
- }
- if (_length != null && (_length < 0)) {
- throw new RangeError.value(_length);
- }
- if (_length + _offset > _source.length) {
- throw new RangeError.value(_length + _offset);
- }
- }
-
- _ListRangeIterator get iterator =>
- new _ListRangeIteratorImpl(_source, _offset, _offset + _length);
-
- int get length => _length;
-}
-
-/**
- * The _ListRangeIterator provides more capabilities than a standard iterator,
- * including the ability to get the current position, count remaining items,
- * and move forward/backward within the iterator.
- */
-abstract class _ListRangeIterator implements Iterator<int> {
- bool moveNext();
- int get current;
- int get position;
- void backup([by]);
- int get remaining;
- void skip([count]);
-}
-
-class _ListRangeIteratorImpl implements _ListRangeIterator {
- final List<int> _source;
- int _offset;
- final int _end;
-
- _ListRangeIteratorImpl(this._source, int offset, this._end)
- : _offset = offset - 1;
-
- int get current => _source[_offset];
-
- bool moveNext() => ++_offset < _end;
-
- int get position => _offset;
-
- void backup([int by = 1]) {
- _offset -= by;
- }
-
- int get remaining => _end - _offset - 1;
-
- void skip([int count = 1]) {
- _offset += count;
- }
-}
-
« no previous file with comments | « pkg/utf/lib/constants.dart ('k') | pkg/utf/lib/src/constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698