Exemplo n.º 1
0
  public synchronized boolean changeLeafElement(String xmlName, String oldValue, String newValue) {
    List<Child> children = this.children; // fix the snapshot that we'll work with

    int len = children.size();
    for (int i = 0; i < len; i++) {
      Child child = children.get(i);
      if (child.name.equals(xmlName) && ((LeafChild) child).value.equals(oldValue)) {
        return (children.set(i, new LeafChild(xmlName, newValue)) != null);
      }
    }
    return false;
  }