private static void saveEquations(@NotNull DataOutput out, Equations eqs) throws IOException {
      out.writeBoolean(eqs.stable);
      DataInputOutputUtil.writeINT(out, eqs.results.size());
      for (DirectionResultPair pair : eqs.results) {
        DataInputOutputUtil.writeINT(out, pair.directionKey);
        Result rhs = pair.result;
        if (rhs instanceof Value finalResult) {
          out.writeBoolean(true); // final flag
          DataInputOutputUtil.writeINT(out, finalResult.ordinal());
        }
        else if (rhs instanceof Pending pendResult) {
          out.writeBoolean(false); // pending flag
          DataInputOutputUtil.writeINT(out, pendResult.delta.length);

          for (Component component : pendResult.delta) {
            DataInputOutputUtil.writeINT(out, component.value.ordinal());
            EKey[] ids = component.ids;
            DataInputOutputUtil.writeINT(out, ids.length);
            for (EKey hKey : ids) {
              writeKey(out, hKey);
            }
          }
        }
        else if (rhs instanceof Effects effects) {
          DataInputOutputUtil.writeINT(out, effects.effects.size());
          for (EffectQuantum effect : effects.effects) {
            writeEffect(out, effect);
          }
          writeDataValue(out, effects.returnValue);
        }
      }
    }
private static void saveEquations(@NotNull DataOutput out, Equations eqs)