Exemplo n.º 1
0
  // AddDir - Rename
  public TranspResult transp(AddDir c1, Rename c2) {
    if (c1.getPath().equals(c2.getPath())) {
      // Rename the AddDir and Delete the Rename
      c1.setPath(c2.getNewPath());

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

    if (childOf(c1, c2)) {
      // rename the parent path concerned by the rename
      c1.setPath(replacePath(c1.getPath(), c2.getNewPath()));

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

    return new TranspResult(c2, c1, true);
  }
Exemplo n.º 2
0
  // AddDir - Remove
  public TranspResult transp(AddDir c1, Remove c2) {
    if (c1.getPath().equals(c2.getPath())) {
      // No need to create the dir and to keep the remove
      return new TranspResult(new EmptyOp(c1), new EmptyOp(c2), false);
    }

    if (childOf(c1, c2)) {
      // Remove a parent dir
      return new TranspResult(c2, new EmptyOp(c1), true);
    }

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