public void addNext(InputElement input) {
   if (parentElement != null) {
     int index = parentElement.childElements.indexOf(this);
     parentElement.childElements.add(index + 1, input);
     InputElement next = nextElement;
     nextElement = input;
     input.nextElement = next;
   }
   input.parentElement = this.parentElement;
 }
 public void addChild(InputElement input) {
   if (childElements == null) {
     childElements = new ArrayList<InputElement>(1);
   } else if (childElements.size() > 0) {
     InputElement last = childElements.get(childElements.size() - 1);
     last.nextElement = input;
   }
   childElements.add(input);
   input.parentElement = this;
 }