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

Side by Side Diff: runtime/bin/buffer_list.dart

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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 | « pkg/unittest/core_matchers.dart ('k') | runtime/bin/common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Utility class that holds a number of byte buffers and can deliver 6 * Utility class that holds a number of byte buffers and can deliver
7 * the bytes either one by one or in chunks. 7 * the bytes either one by one or in chunks.
8 */ 8 */
9 class _BufferList { 9 class _BufferList {
10 _BufferList() { 10 _BufferList() {
11 clear(); 11 clear();
12 } 12 }
13 13
14 /** 14 /**
15 * Adds a new buffer to the list possibly with an offset of the 15 * Adds a new buffer to the list possibly with an offset of the
16 * first byte of interest. The offset can only be specified if the 16 * first byte of interest. The offset can only be specified if the
17 * buffer list is empty. 17 * buffer list is empty.
18 */ 18 */
19 void add(List<int> buffer, [int offset = 0]) { 19 void add(List<int> buffer, [int offset = 0]) {
20 assert(offset == 0 || _buffers.isEmpty()); 20 assert(offset == 0 || _buffers.isEmpty);
21 _buffers.addLast(buffer); 21 _buffers.addLast(buffer);
22 _length += buffer.length; 22 _length += buffer.length;
23 if (offset != 0) _index = offset; 23 if (offset != 0) _index = offset;
24 } 24 }
25 25
26 /** 26 /**
27 * Returns the first buffer from the list. This returns the whole 27 * Returns the first buffer from the list. This returns the whole
28 * buffer and does not remove the buffer from the list. Use 28 * buffer and does not remove the buffer from the list. Use
29 * [index] to determine the index of the first byte in the buffer. 29 * [index] to determine the index of the first byte in the buffer.
30 */ 30 */
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 /** 129 /**
130 * Returns the total number of bytes remaining in the buffers. 130 * Returns the total number of bytes remaining in the buffers.
131 */ 131 */
132 int get length => _length; 132 int get length => _length;
133 133
134 /** 134 /**
135 * Returns whether the buffer list is empty that is has no bytes 135 * Returns whether the buffer list is empty that is has no bytes
136 * available. 136 * available.
137 */ 137 */
138 bool isEmpty() => _buffers.isEmpty(); 138 bool get isEmpty => _buffers.isEmpty;
139 139
140 /** 140 /**
141 * Clears the content of the buffer list. 141 * Clears the content of the buffer list.
142 */ 142 */
143 void clear() { 143 void clear() {
144 _index = 0; 144 _index = 0;
145 _length = 0; 145 _length = 0;
146 _buffers = new Queue(); 146 _buffers = new Queue();
147 } 147 }
148 148
149 int _length; // Total number of bytes remaining in the buffers. 149 int _length; // Total number of bytes remaining in the buffers.
150 Queue<List<int>> _buffers; // List of data buffers. 150 Queue<List<int>> _buffers; // List of data buffers.
151 int _index; // Index of the next byte in the first buffer. 151 int _index; // Index of the next byte in the first buffer.
152 } 152 }
OLDNEW
« no previous file with comments | « pkg/unittest/core_matchers.dart ('k') | runtime/bin/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698