package ac.essex.ooechs.problems.classification;

import ac.essex.ooechs.lcs.InputVector;

/**
 * Allows floating point data to be represented.
 *
 * @author Olly Oechsle, University of Essex, Date: 27-Feb-2008
 * @version 1.0
 */
public class FeatureInput extends InputVector {

    protected int classID;
    protected double[] data;
    
    public FeatureInput(double[] data, int classID) {
        this.data = data;
        this.classID = classID;
    }

    /**
     * Returns the size of the input in terms of the number of features it contains.
     */
    public int getLength() {
        return data.length;
    }

    /**
     * Returns the feature with the given index. This can be implemented however you like.
     */
    public double getValue(int index) {
        return data[index];
    }

    /**
     * Returns the class ID associated with the feature vector.
     */
    public int getClassID() {
        return classID;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            sb.append(data[i]);
            sb.append(",");
       }
        return sb.toString();
    }

}
