private @Nullable MergePatch tryMergeDiffs(Supplier<MergePatch> singleDiff) {
      if (!(mySingleDiff instanceof DropOrderingMergePatch)) return null;
      MergePatch diff = singleDiff.get();
      if (diff instanceof DropOrderingMergePatch && diff.myApplyToRight != mySingleDiff.myApplyToRight) {
        DistinctPairSet.DistinctPair oldPair = ((DropOrderingMergePatch)mySingleDiff).myPair;
        DistinctPairSet.DistinctPair newPair = ((DropOrderingMergePatch)diff).myPair;
        if (oldPair.getFirst().equals(newPair.getSecond()) && newPair.getFirst().equals(oldPair.getSecond())) {
          // The same pair but found starting from the other state
          return mySingleDiff;
        }
      }
      // ordering like a < b may affect types of the variables: in this case merge both types and ordering
      if (diff instanceof UpdateVariableMergePatch updateVar) {
        DfaVariableValue var = updateVar.myValue;
        DfaVariableValue otherVar;
        DistinctPairSet.DistinctPair pair = ((DropOrderingMergePatch)mySingleDiff).myPair;
        boolean left;
        if (pair.getFirst().contains(var)) {
          left = true;
          otherVar = pair.getSecond().getCanonicalVariable();
        }
        else if (pair.getSecond().contains(var)) {
          left = false;
          otherVar = pair.getFirst().getCanonicalVariable();
        } else {
          return null;
        }
        if (otherVar == null) return null;
        if (mySingleDiff.myApplyToRight) {
          left = !left;
        }
        if (updateVar.myType.meetRelation(left ? RelationType.LT : RelationType.GT, myLeftState.getDfType(otherVar))
              .equals(myLeftState.getDfType(var)) &&
            updateVar.myType.meetRelation(left ? RelationType.GT : RelationType.LT, myRightState.getDfType(otherVar))
              .equals(myRightState.getDfType(var))) {
          return new DropOrderingMergePatch(mySingleDiff.myApplyToRight, pair, mySingleDiff.myPatcher.andThen(diff.myPatcher));
        }
      }
      return null;
    }
private @Nullable MergePatch tryMergeDiffs(Supplier<MergePatch> singleDiff)