compareChangeOrder function

int compareChangeOrder(
  1. Change a,
  2. Change b
)

Orders two Changes first by hlc, then by author.

This is the replay order: the order ChangeList.sorted puts changes in before a consumer folds them into its state. Two changes never compare equal — the same author cannot issue the same clock twice.

Implementation

int compareChangeOrder(Change a, Change b) {
  final hlcCompare = a.hlc.compareTo(b.hlc);
  if (hlcCompare != 0) {
    return hlcCompare;
  }
  return a.author.compareTo(b.author);
}