treeList.setChildLabel(headIdx, Symbol.add(oldHead + "-head"));
treeList.setChildLabel(headIdx, Symbol.add(oldHead + headSuffix()));
  public Sexp addHeadInformation(Sexp tree) {    if (tree.isSymbol() ||	Language.treebank().isPreterminal(tree))      return tree;    if (tree.isList()) {      /*      SexpList treeList = tree.list();      int treeListLength = treeList.length();      Symbol parent = treeList.first().symbol();      SexpList result = new SexpList();      result.add(parent);      SexpList children = new SexpList(treeListLength - 1);      for (int i = 1; i < treeListLength; i++)	children.add(treeList.getChildLabel(i));      int headIdx = findHead(tree, treeList.first().symbol(), children);      if (headIdx == 0)	throw new RuntimeException(getClass().getName() + ": error: " +				   "couldn't find head for " + tree);      if (headIdx > 1) {	SexpList preHead = new SexpList(headIdx);	preHead.add(Symbol.add(parent + preHeadSuffix));	for (int i = 1; i < headIdx; i++)	  preHead.add(addHeadInformation(treeList.get(i)));	result.add(preHead);      }      SexpList head = new SexpList(2);      head.add(Symbol.add(parent + headSuffix));      head.add(addHeadInformation(treeList.get(headIdx)));      result.add(head);      if (headIdx < treeListLength - 1) {	SexpList postHead = new SexpList(treeListLength - headIdx - 1);	postHead.add(Symbol.add(parent + postHeadSuffix));	for (int i = headIdx + 1; i < treeListLength; i++)	  postHead.add(addHeadInformation(treeList.get(i)));	result.add(postHead);      }      return result;      */      SexpList treeList = tree.list();      int treeListLen = treeList.length();      // first, find heads for all nodes in this subtree      for (int i = 1; i < treeListLen; i++)	addHeadInformation(treeList.get(i));      // now, modify this subtree's head child's label      Symbol parent = treeList.first().symbol();      SexpList children = new SexpList(treeListLen - 1);      for (int i = 1; i < treeListLen; i++)	children.add(treeList.getChildLabel(i));      int headIdx = findHead(tree, treeList.first().symbol(), children);      if (headIdx == 0)	throw new RuntimeException(getClass().getName() + ": error: " +				   "couldn't find head for " + tree);      Symbol oldHead = treeList.getChildLabel(headIdx);      treeList.setChildLabel(headIdx, Symbol.add(oldHead + "-head"));      return tree;    }    return null;  }