import Tree;

/**
 * A vertex in a generic tree.
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of April 2000
 */
public interface TreeVertex
{
    // +------------+------------------------------------
    // | Extractors |
    // +------------+

    /**
     * Get a child.  The children are numbered starting
     * with 1.
     * Pre: 1 <= childNum <= this.numChildren()
     * Post: Returns the corresponding child.
     */
    public TreeVertex getChild(int childNum);

    /**
     * Get a parent.
     * Pre: Not the root.
     * Post: Returns the vertex of the parent.
     */
    public TreeVertex getParent();

    /**
     * What values lurks at this vertex?
     */
    public Object getValue();

    /**
     * Is the vertex a leaf of the tree?
     */
    public boolean isLeaf();

    /**
     * Is the vertex the root of the tree?
     */
    public boolean isRoot();

    /**
     * Determine how many children the vertex has.
     * Pre: None
     * Post: Returns the number of children.  Note
     *       that a leaf has 0 children.
     */
    public int numChildren();

    // +-----------+-------------------------------------
    // | Modifiers |
    // +-----------+

    /**
     * Set the value associated with a vertex.  Changes
     * the whole dang tree.
     */
    public void setValue(Object newValue);

} // interface TreeVertex

