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 #library('observable'); | 5 #library('observable'); |
6 | 6 |
7 #import('dart:coreimpl'); | 7 #import('dart:coreimpl'); |
8 | 8 |
9 #source('ChangeEvent.dart'); | 9 #source('ChangeEvent.dart'); |
10 #source('EventBatch.dart'); | 10 #source('EventBatch.dart'); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 add(element); | 179 add(element); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 int push(T element) { | 183 int push(T element) { |
184 recordListInsert(length, element); | 184 recordListInsert(length, element); |
185 _internal.add(element); | 185 _internal.add(element); |
186 return _internal.length; | 186 return _internal.length; |
187 } | 187 } |
188 | 188 |
189 T last() => _internal.last(); | 189 T get last => _internal.last; |
190 | 190 |
191 T removeLast() { | 191 T removeLast() { |
192 final result = _internal.removeLast(); | 192 final result = _internal.removeLast(); |
193 recordListRemove(length, result); | 193 recordListRemove(length, result); |
194 return result; | 194 return result; |
195 } | 195 } |
196 | 196 |
197 T removeAt(int index) { | 197 T removeAt(int index) { |
198 int i = 0; | 198 int i = 0; |
199 T found = null; | 199 T found = null; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // equality check should be done? | 290 // equality check should be done? |
291 if (newValue !== _value) { | 291 if (newValue !== _value) { |
292 final oldValue = _value; | 292 final oldValue = _value; |
293 _value = newValue; | 293 _value = newValue; |
294 recordPropertyUpdate("value", newValue, oldValue); | 294 recordPropertyUpdate("value", newValue, oldValue); |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 T _value; | 298 T _value; |
299 } | 299 } |
OLD | NEW |