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

Side by Side Diff: pkg/template_binding/lib/src/list_diff.dart

Issue 50203004: port TemplateBinding to ed3266266e751b5ab1f75f8e0509d0d5f0ef35d8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 template_binding.src.list_diff; 5 library template_binding.src.list_diff;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 import 'package:observe/observe.dart' show ListChangeRecord; 8 import 'package:observe/observe.dart' show ListChangeRecord;
9 9
10 /** 10 /**
(...skipping 21 matching lines...) Expand all
32 // TODO(jmesserly): freeze remove list before handing it out? 32 // TODO(jmesserly): freeze remove list before handing it out?
33 /** The items removed, if any. Otherwise this will be an empty list. */ 33 /** The items removed, if any. Otherwise this will be an empty list. */
34 List get removed => _removed; 34 List get removed => _removed;
35 35
36 /** The number of items added. */ 36 /** The number of items added. */
37 int get addedCount => _addedCount; 37 int get addedCount => _addedCount;
38 38
39 int get removedCount => _removed.length; 39 int get removedCount => _removed.length;
40 40
41 /** Returns true if the provided index was changed by this operation. */ 41 /** Returns true if the provided index was changed by this operation. */
42 bool changes(key) { 42 bool indexChanged(key) {
43 // If key isn't an int, or before the index, then it wasn't changed. 43 // If key isn't an int, or before the index, then it wasn't changed.
44 if (key is! int || key < index) return false; 44 if (key is! int || key < index) return false;
45 45
46 // If this was a shift operation, anything after index is changed. 46 // If this was a shift operation, anything after index is changed.
47 if (addedCount != removedCount) return true; 47 if (addedCount != removedCount) return true;
48 48
49 // Otherwise, anything in the update range was changed. 49 // Otherwise, anything in the update range was changed.
50 return key < index + addedCount; 50 return key < index + addedCount;
51 } 51 }
52 52
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 oldIndex++; 259 oldIndex++;
260 break; 260 break;
261 } 261 }
262 } 262 }
263 263
264 if (splice != null) { 264 if (splice != null) {
265 splices.add(splice); 265 splices.add(splice);
266 } 266 }
267 return splices; 267 return splices;
268 } 268 }
OLDNEW
« no previous file with comments | « pkg/template_binding/lib/src/instance_binding_map.dart ('k') | pkg/template_binding/lib/src/node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698