package ee.ut.ga.model;

/**
 * The key object of Map <code>PWM.getPWM()</code>.
 * @author Anton Stalnuhhin
 */
public class MatrixKey {
  private String row; // "A", "C", "G", "T"
  private int column;

  public MatrixKey(String row, int column) {
    this.row = row;
    this.column = column;
  }

  public int getColumn() {
    return column;
  }

  public String getRow() {
    return row;
  }

  public int hashCode() {
    if ("A".equals(row))
      return 10000 + column;
    if ("C".equals(row))
      return 20000 + column;
    if ("G".equals(row))
      return 30000 + column;
    return 40000 + column;
  }
  
  public boolean equals(Object o) {
    if (!(o instanceof MatrixKey))
      throw new ClassCastException("Must be a MatrixKey object!");
    
    return (row.equals(((MatrixKey) o).getRow()) && column == ((MatrixKey) o).getColumn());
  }
}
