// DelBlock - DelBlock
  public TranspResult transp(DelBlock c1, DelBlock c2) {
    int s1 = c1.getDeletePoint();
    int s2 = c2.getDeletePoint();

    if (c1.getPath().equals(c2.getPath())) {
      if (s1 == s2) {
        // 2 in 1
        Collection c = c1.getOldContent();
        c.add(c2.getOldContent());
        c1.setOldContent(c);

        return new TranspResult(c1, new EmptyOp(c2), true);
      } else {
        return new TranspResult(c1, c2, false);
      }
    }

    return new TranspResult(c2, c1, true);
  }
  // AddBlock - DelBlock
  public TranspResult transp(AddBlock c1, DelBlock c2) {
    if (c1.getPath().equals(c2.getPath())) {
      int s1 = c1.getInsertPoint();
      int l1 = c1.getSize();
      int s2 = c2.getDeletePoint();
      int l2 = c2.getSize();
      Object[] add = c1.getContent().toArray();
      Object[] delete = c2.getOldContent().toArray();
      Collection addContent = new ArrayList();
      Collection deleteContent = new ArrayList();

      if ((s1 <= s2) && (s2 < (s1 + l1))) {
        // s2 inside s1
        if (l2 > (l1 - (s2 - s1))) {
          // The delete is bigger than the add
          if (s1 == s2) {
            // The delete remove the add
            for (int i = add.length; i < delete.length; i++) {
              deleteContent.add(delete[i]);
            }

            c2.setOldContent(deleteContent);

            return new TranspResult(c2, new EmptyOp(c1), true);
          } else {
            // The delete remove the tail of the add
            for (int i = 0; i < (s2 - s1); i++) {
              addContent.add(add[i]);
            }

            for (int i = ((s1 + l1) - (s2 - s1)); i < delete.length; i++) {
              deleteContent.add(delete[i]);
            }

            c1.setContent(addContent);
            c2.setOldContent(deleteContent);
            c2.setDeletePoint(s2 - c1.getSize());

            return new TranspResult(c2, c1, true);
          }
        } else {
          // The delete is include in the add
          for (int i = 0; i < add.length; i++) {
            if (!(((s2 - s1) <= i) && (i < (s2 - s1 + l2)))) {
              addContent.add(add[i]);
            }
          }

          if (addContent.size() == 0) {
            return new TranspResult(new EmptyOp(c1), new EmptyOp(c2), false);
          }

          c1.setContent(addContent);

          return new TranspResult(c1, new EmptyOp(c2), false);
        }
      } else {
        // The two blocks are disjoint
        if (s1 < s2) {
          // Add before del
          c2.setDeletePoint(s2 - l1);
        }

        return new TranspResult(c2, c1, true);
      }
    }

    return new TranspResult(c2, c1, true);
  }