alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

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();
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.