historyValuesFor method

  1. @visibleForTesting
Iterable<State<T>> historyValuesFor(
  1. State<T> s,
  2. StateSet<T> context
)

Implementation

@visibleForTesting
Iterable<State<T>> historyValuesFor(State<T> s, StateSet<T> context) {
  final result = StateSet<T>(root);
  for (var hs in s.substates.whereType<HistoryState>()) {
    if (hs.type == HistoryDepth.shallow) {
      result.addAll(s.substates.where((probe) => context.contains(probe)));
    } else {
      result.addAll(
          context.where((probe) => probe.isAtomic && probe.descendsFrom(s)));
    }
  }
  return result.toList();
}