All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nz.ac.waikato.modeljunit.storytest.parse.Variable Maven / Gradle / Ivy

Go to download

A tool for editing test parameters and suggesting additional parameter values. It provides several heuristics (including PairWise and MC/DC) for analyzing a set of input tuples and suggesting missing/extra values.

The newest version!
/**
 * 
 */
package nz.ac.waikato.modeljunit.storytest.parse;

import nz.ac.waikato.modeljunit.storytest.CalcTable;
import nz.ac.waikato.modeljunit.storytest.ColumnName;

/**
 * @author root
 *
 */
public class Variable
  implements Function
{
  private final ColumnName mColumn;
  private final CalcTable mTable;
  
  Variable(String column, CalcTable table)
  {
    this(table.getColumnName(column), table);
  }
  
  Variable(ColumnName column, CalcTable table)
  {
    mColumn = column;
    mTable = table;
  }
  
  public double calculate(int row)
  {
    // System.out.println("DEBUG: mColumn=" + mColumn + "\tnum = " + mTable.getColumnNum(mColumn));
    String val = mTable.getValue(row, mTable.getColumnNum(mColumn));
    if (val == "") {
      return 0;
    } else {
      return Double.parseDouble(val);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy