OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of protobuf; | 5 part of protobuf; |
6 | 6 |
7 class PbList<E> extends Object with ListMixin<E> implements List<E> { | 7 class PbList<E> extends Object with ListMixin<E> implements List<E> { |
8 | 8 |
9 PbList() : _wrappedList = <E>[]; | 9 PbList() : _wrappedList = <E>[]; |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 throw new ArgumentError('Illegal to add value (${val}):' | 160 throw new ArgumentError('Illegal to add value (${val}):' |
161 ' out of range for uint32'); | 161 ' out of range for uint32'); |
162 } | 162 } |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 /** | 166 /** |
167 * A [PbList] that requires its elements to be [int]s in the range | 167 * A [PbList] that requires its elements to be [int]s in the range |
168 * [:2^-63, 2^63 - 1:]. | 168 * [:2^-63, 2^63 - 1:]. |
169 */ | 169 */ |
170 class PbSint64List extends PbList<ByteData> { | 170 class PbSint64List extends PbList<Int64> { |
171 void _validateElement(ByteData val) { | 171 void _validateElement(Int64 val) { |
172 if (!_isSigned64(val)) { | 172 if (!_isSigned64(val)) { |
173 throw new ArgumentError('Illegal to add value (${val}):' | 173 throw new ArgumentError('Illegal to add value (${val}):' |
174 ' out of range for sint64'); | 174 ' out of range for sint64'); |
175 } | 175 } |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 /** | 179 /** |
180 * A [PbList] that requires its elements to be [int]s in the range | 180 * A [PbList] that requires its elements to be [int]s in the range |
181 * [:0, 2^64 - 1:]. | 181 * [:0, 2^64 - 1:]. |
182 */ | 182 */ |
183 class PbUint64List extends PbList<ByteData> { | 183 class PbUint64List extends PbList<Int64> { |
184 void _validateElement(ByteData val) { | 184 void _validateElement(Int64 val) { |
185 if (!_isUnsigned64(val)) { | 185 if (!_isUnsigned64(val)) { |
186 throw new ArgumentError('Illegal to add value (${val}):' | 186 throw new ArgumentError('Illegal to add value (${val}):' |
187 ' out of range for uint64'); | 187 ' out of range for uint64'); |
188 } | 188 } |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 /** | 192 /** |
193 * A [PbList] that requires its elements to be [double]s in the range | 193 * A [PbList] that requires its elements to be [double]s in the range |
194 * [:-3.4E38, 3.4E38:], i.e., with the IEEE single-precision range. | 194 * [:-3.4E38, 3.4E38:], i.e., with the IEEE single-precision range. |
195 */ | 195 */ |
196 class PbFloatList extends PbList<double> { | 196 class PbFloatList extends PbList<double> { |
197 void _validateElement(double val) { | 197 void _validateElement(double val) { |
198 if (!_isFloat32(val)) { | 198 if (!_isFloat32(val)) { |
199 throw new ArgumentError('Illegal to add value (${val}):' | 199 throw new ArgumentError('Illegal to add value (${val}):' |
200 ' out of range for float'); | 200 ' out of range for float'); |
201 } | 201 } |
202 } | 202 } |
203 } | 203 } |
OLD | NEW |