package yi.iu.ft.local;

public class QuantizedFeature implements java.io.Serializable{
  /**
   * Quantized feature instances for one case
   */
  int[][] m_quantized;

  public QuantizedFeature(int[][] quantized) {
    m_quantized = quantized;
  }

  public QuantizedFeature(int case_num, int feature_num) {
    m_quantized = new int[case_num][feature_num];
  }

  public int getInstanceNum() {
    return m_quantized.length;
  }

  public int[][] getQuantized() {
    return m_quantized;
  }

  public int[] getQuantized(int instance_index) {
    return m_quantized[instance_index];
  }

  public void setQuantized(int case_index, int feature_index, int quantized) {
    m_quantized[case_index][feature_index] = quantized;
  }

  public String toString() {
    StringBuffer str = new StringBuffer();
    for (int i=0; i<m_quantized.length; i++) {
      for (int j=0; j<m_quantized[i].length; j++) {
        if (j!=0) str.append(",");
        str.append(Integer.toString(m_quantized[i][j]));
      }
      str.append(System.getProperty("line.separator"));
    }
    return str.toString();
  }
}