import java.util.Vector;
import java.util.Enumeration;

public class NodeVector {

    Vector V;
    
    public NodeVector(){V = new Vector();}
    public int size(){return V.size();}
    public boolean isEmpty(){return V.isEmpty();}
    public boolean contains(Node v){return V.contains(v);}
    public void addElement(Node v){V.addElement(v);}
    public Node elementAt(int i){return (Node)V.elementAt(i);}
    public Node get(int i){return (Node)V.get(i);}
    public void removeElementAt(int i){V.removeElementAt(i);}
    public void removeAllElements(){V.removeAllElements();}
    public void insertElementAt(Node v,int i){V.insertElementAt(v,i);}
    public String toString(){return V.toString();}
    public NodeEnumeration elements(){return new NodeEnumeration(V);}
    public boolean remove(Node v){return V.remove(v);}
    public void clear(){V.clear();}

    public void insertInSpeciesOrder(Node v){
	if ((v.isLeaf() && V.isEmpty()) || !v.isLeaf()) V.addElement(v);
	else {
	    int i = 0,
		n = V.size();
	    while (i<n && v.getSpeciesNo() > ((Node)V.get(i)).getSpeciesNo()) i++;
	    V.insertElementAt(v,i);
	}
    }


    public void insertInDepthOrder(Node v){
	if (V.isEmpty()) V.addElement(v);
	else {
	    int i = 0,
		n = V.size();
	    while (i<n && v.getDepth() < ((Node)V.get(i)).getDepth()) i++;
	    V.insertElementAt(v,i);
	}
    }

}
