conditionalDriveOther method

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

Makes this conditionally drive interface signals tagged with tags on other.

In addition to the base Interface.conditionalDriveOther functionality, this also handles conditional driving of signals on 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 conditionalDriveOther(
    Interface<PairDirection> other, Iterable<PairDirection> tags) {
  final conditionals = <Conditional>[
    super.conditionalDriveOther(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.conditionalReceiveOther(
            other.subInterfaces[subIntfName]!, tags));
      } else {
        conditionals.add(subInterface.conditionalDriveOther(
            other.subInterfaces[subIntfName]!, tags));
      }
    });
  }

  return ConditionalGroup(conditionals);
}