Ejemplo n.º 1
0
  public ItemBuilder(String rootName) {

    root = new Item(rootName);

    addItemToArrayList(root);

    current = root;
    parent = root;

    // Store the parent for the Item object

    root.addItemInformation("Parent", parent.getItemName());
  }
Ejemplo n.º 2
0
  public void addChild(String child) {

    Item childNode = new Item(child);

    addItemToArrayList(childNode);

    current.add(childNode);
    parent = current;
    current = childNode;

    // Store the parent for the Item object

    childNode.addItemInformation("Parent", parent.getItemName());
  }
Ejemplo n.º 3
0
  public void addSibling(String sibling) {

    Item siblingNode = new Item(sibling);

    addItemToArrayList(siblingNode);

    // Adding a child node to the parent Item

    parent.add(siblingNode);
    current = siblingNode;

    // Store the parent for the Item object

    siblingNode.addItemInformation("Parent", parent.getItemName());
  }
Ejemplo n.º 4
0
  public void addItemInformation(String name, String value) {

    current.addItemInformation(name, value);
  }