Exemplo n.º 1
0
 public void printChildren() {
   System.out.print("Children: ");
   if (children.isEmpty()) System.out.print("null");
   else {
     for (int i = 0; i < children.size(); ++i) {
       Node child = children.get(i);
       System.out.print(child.getName() + "\t");
     }
   }
   System.out.println();
 }
Exemplo n.º 2
0
 public void printSiblings() {
   if (parent == null) System.out.println("Siblings: " + parent);
   else {
     System.out.print("Siblings: ");
     ArrayList<Node> siblings = parent.getChildren();
     if (siblings.isEmpty()) System.out.print("null");
     else {
       for (int i = 0; i < siblings.size(); ++i) {
         Node child = siblings.get(i);
         if (!child.getName().equals(name)) System.out.print(child.getName() + "\t");
       }
     }
     System.out.println();
   }
 }
Exemplo n.º 3
0
 public void printParent() {
   if (parent == null) System.out.println("Parent: " + parent);
   else System.out.println("Parent: " + parent.getName());
 }