/*
 * InternalNode.java
 *
 * Created on May 18, 2004, 9:23 PM
 */

package spamfilter.decisiontree;

/**
 *
 * @author  AaronStJ
 */
public class InternalNode implements Node, Cloneable {
    
    private Node trueChild = null;
    private Node falseChild = null;
    private String word;
    
    /** Creates a new instance of InternalNode */
    public InternalNode(String w) {        
        word = w;
    }
    
    public boolean isLeaf() {
        return false;
    }
    
    public void setTrueChild(Node tc) { trueChild = tc; }
    public Node getTrueChild() { return trueChild; }
    
    public void setFalseChild(Node tc) { falseChild = tc; }
    public Node getFalseChild() { return falseChild; }
    
    public void setWord(String w) { word = w; }
    public String getWord() { return word; }
    
    public Object clone() {
        InternalNode n = null;        
        
        try {
            n = (InternalNode)super.clone();

            Node falseClone = (Node)this.getFalseChild().clone();
            Node trueClone = (Node)this.getTrueChild().clone();
            
            n.falseChild = (falseClone);
            n.trueChild = (trueClone);           

        } catch (Exception e) { }
        
        return n;
    }
    
    
    
}
