use of cbit.vcell.modelopt.ParameterMappingSpec in project vcell by virtualcell.
the class ParameterMappingTableModel method setValueAt.
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if (columnIndex < 0 || columnIndex >= getColumnCount()) {
throw new RuntimeException("ParameterTableModel.setValueAt(), column = " + columnIndex + " out of range [" + 0 + "," + (getColumnCount() - 1) + "]");
}
ParameterMappingSpec parameterMappingSpec = getValueAt(rowIndex);
switch(columnIndex) {
case COLUMN_LOWVALUE:
{
if (aValue instanceof Double) {
double value = ((Double) aValue).doubleValue();
parameterMappingSpec.setLow(value);
fireTableRowsUpdated(rowIndex, rowIndex);
} else if (aValue instanceof String) {
String newDoubleString = (String) aValue;
try {
parameterMappingSpec.setLow(Double.parseDouble(newDoubleString));
fireTableRowsUpdated(rowIndex, rowIndex);
} catch (NumberFormatException e) {
if (newDoubleString.equals("") || newDoubleString.equalsIgnoreCase("-Infinity") || newDoubleString.equalsIgnoreCase("-Inf")) {
parameterMappingSpec.setLow(Double.NEGATIVE_INFINITY);
fireTableRowsUpdated(rowIndex, rowIndex);
}
}
}
break;
}
case COLUMN_HIGHVALUE:
{
if (aValue instanceof Double) {
double value = ((Double) aValue).doubleValue();
parameterMappingSpec.setHigh(value);
fireTableRowsUpdated(rowIndex, rowIndex);
} else if (aValue instanceof String) {
String newDoubleString = (String) aValue;
try {
parameterMappingSpec.setHigh(Double.parseDouble(newDoubleString));
fireTableRowsUpdated(rowIndex, rowIndex);
} catch (NumberFormatException e) {
if (newDoubleString.equals("") || newDoubleString.equalsIgnoreCase("Infinity") || newDoubleString.equalsIgnoreCase("Inf")) {
parameterMappingSpec.setHigh(Double.POSITIVE_INFINITY);
fireTableRowsUpdated(rowIndex, rowIndex);
}
}
}
break;
}
case COLUMN_CURRENTVALUE:
{
if (aValue instanceof Double) {
double value = ((Double) aValue).doubleValue();
parameterMappingSpec.setCurrent(value);
fireTableRowsUpdated(rowIndex, rowIndex);
} else if (aValue instanceof String) {
parameterMappingSpec.setCurrent(Double.parseDouble((String) aValue));
fireTableRowsUpdated(rowIndex, rowIndex);
}
break;
}
}
}
use of cbit.vcell.modelopt.ParameterMappingSpec in project vcell by virtualcell.
the class ParameterMappingTableModel method setParameterEstimationTask.
/**
* Sets the parameterEstimationTask property (cbit.vcell.modelopt.ParameterEstimationTask) value.
* @param parameterEstimationTask The new value for the property.
* @see #getParameterEstimationTask
*/
public void setParameterEstimationTask(ParameterEstimationTask newValue) {
if (fieldParameterEstimationTask == newValue) {
return;
}
ParameterEstimationTask oldValue = fieldParameterEstimationTask;
if (oldValue != null) {
oldValue.removePropertyChangeListener(this);
oldValue.getModelOptimizationSpec().removePropertyChangeListener(this);
ParameterMappingSpec[] oldPMS = oldValue.getModelOptimizationSpec().getParameterMappingSpecs();
for (int i = 0; oldPMS != null && i < oldPMS.length; i++) {
oldPMS[i].removePropertyChangeListener(this);
}
}
fieldParameterEstimationTask = newValue;
if (newValue != null) {
newValue.addPropertyChangeListener(this);
newValue.getModelOptimizationSpec().addPropertyChangeListener(this);
ParameterMappingSpec[] newPMS = newValue.getModelOptimizationSpec().getParameterMappingSpecs();
for (int i = 0; newPMS != null && i < newPMS.length; i++) {
newPMS[i].addPropertyChangeListener(this);
}
}
refreshData();
}
Aggregations