conditionalReceiveOther method

  1. @override
Conditional conditionalReceiveOther(
  1. Interface<PairDirection> other,
  2. Iterable<PairDirection> tags
)
inherited

Makes this signals tagged with tags be driven conditionally by other.

In addition to the base Interface.conditionalReceiveOther functionality, this also handles conditional receiving of signals from all subInterfaces hierarchically when other is a PairInterface. Returns a ConditionalGroup that combines all conditionals from the main interface and sub-interfaces, considering reverse.

Implementation

@override
Conditional conditionalReceiveOther(
    Interface<PairDirection> other, Iterable<PairDirection> tags) {
  final conditionals = <Conditional>[
    super.conditionalReceiveOther(other, tags)
  ];

  if (other is PairInterface) {
    subInterfaces.forEach((subIntfName, subInterface) {
      if (!other.subInterfaces.containsKey(subIntfName)) {
        throw InterfaceTypeException(
            other, 'missing a sub-interface named $subIntfName');
      }

      if (_subInterfaces[subIntfName]!.reverse) {
        conditionals.add(subInterface.conditionalDriveOther(
            other.subInterfaces[subIntfName]!, tags));
      } else {
        conditionals.add(subInterface.conditionalReceiveOther(
            other.subInterfaces[subIntfName]!, tags));
      }
    });
  }

  return ConditionalGroup(conditionals);
}