devdaily home | apple | java | perl | unix | directory | blog

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code


/**
 *  Tree.java
 */

package com.coolservlets.beans.tree;

import java.util.Vector;

public class Tree implements TreeInterface {

    private Vector children;
    private int selected;
    private String name;

    public static int NODE = 0;
    public static int LEAF = 1;

    public Tree() {
        children = new Vector();
    }
    
    public Tree( String name ) {
        this.name = name;
        children = new Vector();
    }

    public String getName() {
        return this.name;
    }
    public void setName( String name ) {
        this.name = name;
    }

    public int getSelected() {
        return this.selected;
    }

    public void setSelected( int selected ) {
        this.selected = selected;
    }

    public void addChild (TreeObject child) {
        children.addElement(child);
    }

    public TreeObject getChild(int index) {
        return (TreeObject)children.elementAt(index);
    }

    public int size() {
        return children.size();
    }
}




Copyright 1998-2008 Alvin Alexander
All Rights Reserved.
 
devdaily.com is based in louisville, kentucky, and this web site is hosted by godaddy.com