@@ -983,9 +983,8 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
983
983
}
984
984
985
985
/**
986
- * Reset the state of the change objects to show no changes. This means set
987
- * previousKey to currentKey, and clear all of the queues (additions, moves,
988
- * removals).
986
+ * Reset the state of the change objects to show no changes. This means set previousKey to
987
+ * currentKey, and clear all of the queues (additions, moves, removals).
989
988
*/
990
989
void _reset () {
991
990
if (isDirty) {
@@ -999,6 +998,8 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
999
998
}
1000
999
}
1001
1000
1001
+ /// Set the [previousIndex] es of moved and added items to their [currentIndex] es
1002
+ /// Reset the list of additions, moves and removals
1002
1003
void _undoDeltas () {
1003
1004
ItemRecord <V > record;
1004
1005
@@ -1021,19 +1022,16 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
1021
1022
assert (isDirty == false );
1022
1023
}
1023
1024
1024
- /**
1025
- * A [_CollectionChangeRecord] is considered dirty if it has additions, moves
1026
- * or removals.
1027
- */
1025
+ /// A [_CollectionChangeRecord] is considered dirty if it has additions, moves or removals.
1028
1026
bool get isDirty => _additionsHead != null ||
1029
1027
_movesHead != null ||
1030
1028
_removalsHead != null ;
1031
1029
1032
1030
/**
1033
1031
* This is the core function which handles differences between collections.
1034
1032
*
1035
- * - [record] is the record which we saw at this position last time. If
1036
- * [:null:] then it is a new item.
1033
+ * - [record] is the record which we saw at this position last time. If [:null:] then it is a new
1034
+ * item.
1037
1035
* - [item] is the current item in the collection
1038
1036
* - [index] is the position of the item in the collection
1039
1037
*/
@@ -1325,15 +1323,15 @@ class ItemRecord<V> extends CollectionChangeItem<V> {
1325
1323
: '$item [$previousIndex -> $currentIndex ]' ;
1326
1324
}
1327
1325
1326
+ /// A linked list of [ItemRecord] s with the same [ItemRecord.item]
1328
1327
class _DuplicateItemRecordList {
1329
1328
ItemRecord head, tail;
1330
1329
1331
1330
/**
1332
- * Add the [record] before the [previousRecord ] in the list of duplicates or
1333
- * at the end of the list when no [previousRecord ] is specified.
1331
+ * Add the [record] before the [insertBefore ] in the list of duplicates or at the end of the list
1332
+ * when no [insertBefore ] is specified.
1334
1333
*
1335
- * Note: by design all records in the list of duplicates hold the save value
1336
- * in [record.item] .
1334
+ * Note: by design all records in the list of duplicates hold the save value in [record.item] .
1337
1335
*/
1338
1336
void add (ItemRecord record, ItemRecord previousRecord) {
1339
1337
assert (previousRecord == null || previousRecord.item == record.item);
@@ -1364,7 +1362,9 @@ class _DuplicateItemRecordList {
1364
1362
}
1365
1363
}
1366
1364
1367
- ItemRecord get (key, int hideIndex) {
1365
+ /// Returns an [ItemRecord] having [ItemRecord.item] == [item] and [ItemRecord.currentIndex] >=
1366
+ /// [hideIndex]
1367
+ ItemRecord get (item, int hideIndex) {
1368
1368
ItemRecord record;
1369
1369
for (record = head; record != null ; record = record._nextDup) {
1370
1370
if ((hideIndex == null || hideIndex < record.currentIndex) &&
@@ -1378,7 +1378,7 @@ class _DuplicateItemRecordList {
1378
1378
/**
1379
1379
* Remove one [ItemRecord] from the list of duplicates.
1380
1380
*
1381
- * Returns whether when the list of duplicates is empty.
1381
+ * Returns whether the list of duplicates is empty.
1382
1382
*/
1383
1383
bool remove (ItemRecord record) {
1384
1384
assert (() {
@@ -1406,11 +1406,10 @@ class _DuplicateItemRecordList {
1406
1406
}
1407
1407
1408
1408
/**
1409
- * [DuplicateMap] maps [ItemRecord.value] to a list of [ItemRecord] having the
1410
- * same value (duplicates).
1409
+ * [DuplicateMap] maps [ItemRecord.value] to a list of [ItemRecord] having the same value
1410
+ * (duplicates).
1411
1411
*
1412
1412
* The list of duplicates is implemented by [_DuplicateItemRecordList] .
1413
- *
1414
1413
*/
1415
1414
class DuplicateMap {
1416
1415
final map = < dynamic , _DuplicateItemRecordList > {};
@@ -1421,13 +1420,11 @@ class DuplicateMap {
1421
1420
}
1422
1421
1423
1422
/**
1424
- * Retrieve the `value` using [key] . Because the [ItemRecord] value maybe one
1425
- * which we have already iterated over, we use the [hideIndex] to pretend it
1426
- * is not there.
1423
+ * Retrieve the `value` using [key] . Because the [ItemRecord] value maybe one which we have
1424
+ * already iterated over, we use the [hideIndex] to pretend it is not there.
1427
1425
*
1428
- * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a`
1429
- * then asking if we have any more `a` s needs to return the last `a` not the
1430
- * first or second.
1426
+ * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
1427
+ * have any more `a` s needs to return the last `a` not the first or second.
1431
1428
*/
1432
1429
ItemRecord get (key, [int hideIndex]) {
1433
1430
_DuplicateItemRecordList recordList = map[key];
0 commit comments