opposite function

Returns the opposite of r.

Implementation

TimeComparisonResult opposite(TimeComparisonResult r) {
  return r == TimeComparisonResult.after
      ? TimeComparisonResult.before // before is opposite of after
      : r == TimeComparisonResult.before
          ? TimeComparisonResult.after // after is opopsite of before
          : r; // same and overlapping are identical in inverse
}