/**
   * Basically overridden for debugging purposes. Gives an inaccurate LaTeX-code representation of
   * this node.
   *
   * @return The inaccurate LaTeX representation.
   */
  @Override
  public String toString() {
    final StringBuffer sb = new StringBuffer();

    Node child;
    for (int i = 0; i < children.size(); i++) {
      child = children.get(i);
      sb.append(child.toString());
    }

    return sb.toString();
  }
  /**
   * @param clasz the Class the node must be assignable to
   * @return the first child node (searches subchildren too, so result may be child of child..)
   *     which is assignable to the clasz
   */
  @SuppressWarnings("unchecked")
  public AbstractNode findFirstChild(final Class clasz) {
    AbstractNode matchingNode = null;

    Iterator<Node> it = children.iterator();
    Node node;
    while (it.hasNext()) {
      node = it.next();
      if (clasz.isAssignableFrom(node.getClass())) {
        matchingNode = (AbstractNode) node;
      } else if (node instanceof NodeWithChildsImpl) {
        matchingNode = findFirstChild(clasz);
      }
    }

    return matchingNode;
  }