Search in sources :

Example 1 with TestCriteriaNewBioModel

use of cbit.vcell.numericstest.TestCriteriaNewBioModel in project vcell by virtualcell.

the class TestingFrameworkWindowManager method duplicateTestSuite.

/**
 * Insert the method's description here.
 * Creation date: (4/10/2003 11:27:32 AM)
 * @param testCase cbit.vcell.numericstestingframework.TestCase
 */
public String duplicateTestSuite(final TestSuiteInfoNew testSuiteInfo_Original, final TestSuiteInfoNew newTestSuiteInfo, int regrRefFlag, ClientTaskStatusSupport pp) throws DataAccessException {
    if (testSuiteInfo_Original == null || newTestSuiteInfo == null) {
        throw new IllegalArgumentException(this.getClass().getName() + "duplicateTestSuite_Private: TestSuite cannot be null");
    }
    checkNewTestSuiteInfo(newTestSuiteInfo);
    TestSuiteNew testSuite_Original = getRequestManager().getDocumentManager().getTestSuite(testSuiteInfo_Original.getTSKey());
    if (testSuite_Original == null) {
        throw new DataAccessException("Couldn't get TestSuite for tsInfo " + testSuiteInfo_Original.getTSID());
    }
    AddTestSuiteOP testSuiteOP = new AddTestSuiteOP(newTestSuiteInfo.getTSID(), newTestSuiteInfo.getTSVCellBuild(), newTestSuiteInfo.getTSNumericsBuild(), null, newTestSuiteInfo.getTSAnnotation());
    getRequestManager().getDocumentManager().doTestSuiteOP(testSuiteOP);
    TestSuiteInfoNew[] tsinArr = getRequestManager().getDocumentManager().getTestSuiteInfos();
    TestSuiteInfoNew tsin = null;
    for (int i = 0; i < tsinArr.length; i += 1) {
        if (tsinArr[i].getTSID().equals(newTestSuiteInfo.getTSID())) {
            tsin = tsinArr[i];
            break;
        }
    }
    if (tsin == null) {
        throw new DataAccessException("couldn't find new TestSuiteInfo " + newTestSuiteInfo.getTSID() + " in DB");
    }
    TestCaseNew[] originalTestCases = testSuite_Original.getTestCases();
    TestCaseNew[] newTestCases = null;
    if (originalTestCases != null && originalTestCases.length > 0) {
        newTestCases = new TestCaseNew[originalTestCases.length];
        for (int i = 0; i < originalTestCases.length; i += 1) {
            if (originalTestCases[i] instanceof TestCaseNewMathModel) {
                TestCaseNewMathModel tcnmm = (TestCaseNewMathModel) originalTestCases[i];
                TestCriteriaNew[] tcritnmm = (TestCriteriaNew[]) tcnmm.getTestCriterias();
                TestCriteriaNewMathModel[] newTCrits = null;
                if (tcritnmm != null && tcritnmm.length > 0) {
                    // Copy regression and errors
                    newTCrits = new TestCriteriaNewMathModel[tcritnmm.length];
                    for (int j = 0; j < tcritnmm.length; j += 1) {
                        newTCrits[j] = new TestCriteriaNewMathModel(null, tcritnmm[j].getSimInfo(), ((TestCriteriaNewMathModel) tcritnmm[j]).getRegressionMathModelInfo(), tcritnmm[j].getRegressionSimInfo(), tcritnmm[j].getMaxRelError(), tcritnmm[j].getMaxAbsError(), null, // new will have no data
                        TestCriteriaNew.TCRIT_STATUS_NODATA, // new will have no data
                        null);
                    }
                }
                // copy mathmodel,type and annotation and copied tcrits
                newTestCases[i] = new TestCaseNewMathModel(null, tcnmm.getMathModelInfo(), tcnmm.getType(), tcnmm.getAnnotation(), newTCrits);
            } else if (originalTestCases[i] instanceof TestCaseNewBioModel) {
                TestCaseNewBioModel tcnbm = (TestCaseNewBioModel) originalTestCases[i];
                TestCriteriaNew[] tcritnbm = (TestCriteriaNew[]) tcnbm.getTestCriterias();
                TestCriteriaNewBioModel[] newTCrits = null;
                if (tcritnbm != null && tcritnbm.length > 0) {
                    // Copy regression and errors
                    newTCrits = new TestCriteriaNewBioModel[tcritnbm.length];
                    for (int j = 0; j < tcritnbm.length; j += 1) {
                        newTCrits[j] = new TestCriteriaNewBioModel(null, tcritnbm[j].getSimInfo(), ((TestCriteriaNewBioModel) tcritnbm[j]).getRegressionBioModelInfo(), ((TestCriteriaNewBioModel) tcritnbm[j]).getRegressionApplicationName(), tcritnbm[j].getRegressionSimInfo(), tcritnbm[j].getMaxRelError(), tcritnbm[j].getMaxAbsError(), null, // new will have no data
                        TestCriteriaNew.TCRIT_STATUS_NODATA, // new will have no data
                        null);
                    }
                }
                // copy mathmodel,type and annotation and copied tcrits
                newTestCases[i] = new TestCaseNewBioModel(null, tcnbm.getBioModelInfo(), tcnbm.getSimContextName(), tcnbm.getSimContextKey(), tcnbm.getType(), tcnbm.getAnnotation(), newTCrits);
            } else {
                throw new RuntimeException("Unsupported TestCase type " + originalTestCases[i].getClass().getName());
            }
        }
    }
    // Add the new TestCases
    if (newTestCases != null && newTestCases.length > 0) {
        return addTestCases(tsin, newTestCases, regrRefFlag, pp);
    } else {
        return null;
    }
}
Also used : TestSuiteNew(cbit.vcell.numericstest.TestSuiteNew) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) TestCaseNew(cbit.vcell.numericstest.TestCaseNew) TestCaseNewBioModel(cbit.vcell.numericstest.TestCaseNewBioModel) AddTestSuiteOP(cbit.vcell.numericstest.AddTestSuiteOP) TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNew(cbit.vcell.numericstest.TestCriteriaNew) TestCaseNewMathModel(cbit.vcell.numericstest.TestCaseNewMathModel) TestSuiteInfoNew(cbit.vcell.numericstest.TestSuiteInfoNew) DataAccessException(org.vcell.util.DataAccessException)

Example 2 with TestCriteriaNewBioModel

use of cbit.vcell.numericstest.TestCriteriaNewBioModel in project vcell by virtualcell.

the class TestingFrameworkWindowManager method updateTestCriteria.

/**
 * Insert the method's description here.
 * Creation date: (4/9/2003 1:31:08 PM)
 * @return cbit.vcell.numericstestingframework.TestSuiteInfo
 */
public void updateTestCriteria(TestCriteriaNew origTestCriteria, TestCriteriaNew newTestCriteria) throws DataAccessException {
    EditTestCriteriaOP testCriteriaOP = null;
    if (newTestCriteria instanceof TestCriteriaNewMathModel) {
        MathModelInfo regrMMInfo = ((TestCriteriaNewMathModel) newTestCriteria).getRegressionMathModelInfo();
        SimulationInfo regrsimInfo = ((TestCriteriaNewMathModel) newTestCriteria).getRegressionSimInfo();
        testCriteriaOP = new EditTestCriteriaOPMathModel(origTestCriteria.getTCritKey(), (regrMMInfo != null ? regrMMInfo.getVersion().getVersionKey() : null), (regrsimInfo != null ? regrsimInfo.getVersion().getVersionKey() : null), newTestCriteria.getMaxAbsError(), newTestCriteria.getMaxRelError());
    } else if (newTestCriteria instanceof TestCriteriaNewBioModel) {
        BioModelInfo regrBMInfo = ((TestCriteriaNewBioModel) newTestCriteria).getRegressionBioModelInfo();
        SimulationInfo regrsimInfo = ((TestCriteriaNewBioModel) newTestCriteria).getRegressionSimInfo();
        testCriteriaOP = new EditTestCriteriaOPBioModel(origTestCriteria.getTCritKey(), (regrBMInfo != null ? regrBMInfo.getVersion().getVersionKey() : null), (regrsimInfo != null ? regrsimInfo.getVersion().getVersionKey() : null), newTestCriteria.getMaxAbsError(), newTestCriteria.getMaxRelError());
    }
    getRequestManager().getDocumentManager().doTestSuiteOP(testCriteriaOP);
    RemoveTestResultsOP removeTestResults = new RemoveTestResultsOP(new BigDecimal[] { origTestCriteria.getTCritKey() });
    getRequestManager().getDocumentManager().doTestSuiteOP(removeTestResults);
}
Also used : EditTestCriteriaOPMathModel(cbit.vcell.numericstest.EditTestCriteriaOPMathModel) TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) EditTestCriteriaOP(cbit.vcell.numericstest.EditTestCriteriaOP) BioModelInfo(org.vcell.util.document.BioModelInfo) EditTestCriteriaOPBioModel(cbit.vcell.numericstest.EditTestCriteriaOPBioModel) MathModelInfo(org.vcell.util.document.MathModelInfo) RemoveTestResultsOP(cbit.vcell.numericstest.RemoveTestResultsOP) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 3 with TestCriteriaNewBioModel

use of cbit.vcell.numericstest.TestCriteriaNewBioModel in project vcell by virtualcell.

the class TestingFrameworkWindowManager method getNewTestCriteriaFromUser.

/**
 * Insert the method's description here.
 * Creation date: (4/9/2003 1:31:08 PM)
 * @return cbit.vcell.numericstestingframework.TestSuiteInfo
 */
public TestCriteriaNew getNewTestCriteriaFromUser(String solutionType, TestCriteriaNew origTestCriteria) throws UserCancelException {
    // Reset the text fields in the EditCriteriaPanel.
    getEditTestCriteriaPanel().setExistingTestCriteria(origTestCriteria);
    getEditTestCriteriaPanel().setSolutionType(solutionType);
    getEditTestCriteriaPanel().resetTextFields();
    while (true) {
        // display the editCriteriaPanel.
        Object choice = showEditTestCriteriaDialog(getEditTestCriteriaPanel(), getComponent());
        if (choice != null && choice.equals("OK")) {
            TestCriteriaNew tcritNew = getEditTestCriteriaPanel().getNewTestCriteria();
            if (tcritNew instanceof TestCriteriaNewMathModel) {
                TestCriteriaNewMathModel tcritNewMM = (TestCriteriaNewMathModel) tcritNew;
                if ((tcritNewMM.getRegressionMathModelInfo() == null && tcritNewMM.getRegressionSimInfo() != null) || (tcritNewMM.getRegressionMathModelInfo() != null && tcritNewMM.getRegressionSimInfo() == null)) {
                    PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Must specify both Reference MathModel and Simulation");
                    continue;
                }
            } else if (tcritNew instanceof TestCriteriaNewBioModel) {
                TestCriteriaNewBioModel tcritNewBM = (TestCriteriaNewBioModel) tcritNew;
                if ((tcritNewBM.getRegressionBioModelInfo() == null && tcritNewBM.getRegressionSimInfo() != null) || (tcritNewBM.getRegressionBioModelInfo() != null && tcritNewBM.getRegressionSimInfo() == null)) {
                    PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Must specify both Reference BioModel App and Simulation");
                    continue;
                }
            } else {
            }
            return tcritNew;
        }
        throw UserCancelException.CANCEL_GENERIC;
    }
}
Also used : TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) TestCriteriaNew(cbit.vcell.numericstest.TestCriteriaNew)

Example 4 with TestCriteriaNewBioModel

use of cbit.vcell.numericstest.TestCriteriaNewBioModel in project vcell by virtualcell.

the class EditTestCriteriaPanel method resetTextFields.

/**
 * Sets the testSuiteInfo property (cbit.vcell.numericstest.TestSuiteInfo) value.
 * @param testSuiteInfo The new value for the property.
 * @see #getTestSuiteInfo
 */
public void resetTextFields() {
    // If the chosen simInfo already has test criteria defined, set the fields with the appropriate values
    // Else set them to blank.
    getRelErrTextField().setText("");
    getAbsErrTextField().setText("");
    if (getExistingTestCriteria() != null) {
        Double relErr = getExistingTestCriteria().getMaxRelError();
        Double absErr = getExistingTestCriteria().getMaxAbsError();
        getRelErrTextField().setText((relErr != null ? relErr.toString() : null));
        getAbsErrTextField().setText((absErr != null ? absErr.toString() : null));
    }
    // Depending on test case soultion type (which is set by testingFrameworkWindowManager based on the test case
    // the simulation belongs to), enable apprpriate (ref MathModel, ref simInfo buttons) fields.
    // if (!getSolutionType().equals(TestCaseNew.REGRESSION)) {
    getRefMathModelLabel().setText(null);
    getRefSimLabel().setText(null);
    getBioModelAppLabel().setText(null);
    getBmAppSimLabel().setText(null);
    getRefMathModelButton().setEnabled(false);
    getRefMathModelLabel().setEnabled(false);
    getRefSimButton().setEnabled(false);
    getRefSimLabel().setEnabled(false);
    getSelectRefBMAppJButton().setEnabled(false);
    getBioModelAppLabel().setEnabled(false);
    getSelectRefSimJButton().setEnabled(false);
    getBmAppSimLabel().setEnabled(false);
    // } else {
    if (getExistingTestCriteria() instanceof TestCriteriaNewMathModel && getSolutionType().equals(TestCaseNew.REGRESSION)) {
        getRefMathModelButton().setEnabled(true);
        getRefMathModelLabel().setEnabled(true);
        getRefSimButton().setEnabled(true);
        getRefSimLabel().setEnabled(true);
    } else if (getExistingTestCriteria() instanceof TestCriteriaNewBioModel && getSolutionType().equals(TestCaseNew.REGRESSION)) {
        getSelectRefBMAppJButton().setEnabled(true);
        getBioModelAppLabel().setEnabled(true);
        getSelectRefSimJButton().setEnabled(true);
        getBmAppSimLabel().setEnabled(true);
    }
    if (getExistingTestCriteria() != null && getExistingTestCriteria().getRegressionSimInfo() != null) {
        if (getExistingTestCriteria() instanceof TestCriteriaNewMathModel) {
            MathModelInfo refMMInfo = ((TestCriteriaNewMathModel) getExistingTestCriteria()).getRegressionMathModelInfo();
            if (refMMInfo == null) {
                PopupGenerator.showErrorDialog(this, "No MathModelInfo found for SimInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            SimulationInfo refSimInfo = null;
            refSimInfo = getExistingTestCriteria().getRegressionSimInfo();
            if (refSimInfo == null) {
                PopupGenerator.showErrorDialog(this, "No SimulationInfo found for simInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            setReferenceMathModelInfo(refMMInfo);
            setReferenceSimInfo(refSimInfo);
            getRefMathModelLabel().setText("<html>" + refMMInfo.getVersion().getName() + "<br>(MathModelKey=" + refMMInfo.getVersion().getVersionKey() + ")<br>" + refMMInfo.getVersion().getDate() + "<html>");
            getRefSimLabel().setText("<html>" + refSimInfo.getVersion().getName() + "<br>(SimulationKey:" + refSimInfo.getVersion().getVersionKey() + ")</html>");
        } else if (getExistingTestCriteria() instanceof TestCriteriaNewBioModel) {
            BioModelInfo refBMInfo = ((TestCriteriaNewBioModel) getExistingTestCriteria()).getRegressionBioModelInfo();
            if (refBMInfo == null) {
                PopupGenerator.showErrorDialog(this, "No bioModelInfo found for SimInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            SimulationInfo refSimInfo = null;
            refSimInfo = getExistingTestCriteria().getRegressionSimInfo();
            if (refSimInfo == null) {
                PopupGenerator.showErrorDialog(this, "No SimulationInfo found for simInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            setbioModelInfo(refBMInfo);
            setbmAppSimInfo(refSimInfo);
            setappName(((TestCriteriaNewBioModel) getExistingTestCriteria()).getRegressionApplicationName());
            getBioModelAppLabel().setText("<html>" + refBMInfo.getVersion().getName() + "/" + getappName() + "<br>(BioModelKey=" + refBMInfo.getVersion().getVersionKey() + ")<br>" + refBMInfo.getVersion().getDate() + "</html>");
            getBmAppSimLabel().setText("<html>" + refSimInfo.getVersion().getName() + "<br>(SimulationKey:" + refSimInfo.getVersion().getVersionKey() + ")</html>");
        }
    } else {
        setReferenceMathModelInfo(null);
        setReferenceSimInfo(null);
        getRefMathModelLabel().setText("");
        getRefSimLabel().setText("");
        setbioModelInfo(null);
        setbmAppSimInfo(null);
        setappName(null);
        getBioModelAppLabel().setText(null);
        getBmAppSimLabel().setText(null);
    }
// }
}
Also used : TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 5 with TestCriteriaNewBioModel

use of cbit.vcell.numericstest.TestCriteriaNewBioModel in project vcell by virtualcell.

the class EditTestCriteriaPanel method applyTestCriteriaInfo.

/**
 * Comment
 */
private void applyTestCriteriaInfo() {
    TestCriteriaNew newTestCriteria = null;
    Double relErr = Double.valueOf(getRelErrTextField().getText());
    Double absErr = Double.valueOf(getAbsErrTextField().getText());
    if (getSolutionType().equals(TestCaseNew.REGRESSION)) {
        // newTestCriteria = new TestCriteriaNew(null, getExistingTestCriteria().getSimInfo(), getReferenceMathModelInfo(), getReferenceSimInfo(), relErr, absErr, null);
        if (getExistingTestCriteria() instanceof TestCriteriaNewMathModel) {
            newTestCriteria = new TestCriteriaNewMathModel(null, getExistingTestCriteria().getSimInfo(), getReferenceMathModelInfo(), getReferenceSimInfo(), relErr, absErr, null, TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null);
        } else if (getExistingTestCriteria() instanceof TestCriteriaNewBioModel) {
            newTestCriteria = new TestCriteriaNewBioModel(null, getExistingTestCriteria().getSimInfo(), getbioModelInfo(), getappName(), getbmAppSimInfo(), relErr, absErr, null, TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null);
        }
    } else {
        // CONSTRUCTED SOLN OR EXACT SOLUTION
        if (getExistingTestCriteria() instanceof TestCriteriaNewMathModel) {
            newTestCriteria = new TestCriteriaNewMathModel(null, getExistingTestCriteria().getSimInfo(), null, null, relErr, absErr, null, TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null);
        } else if (getExistingTestCriteria() instanceof TestCriteriaNewBioModel) {
            newTestCriteria = new TestCriteriaNewBioModel(null, getExistingTestCriteria().getSimInfo(), null, null, null, relErr, absErr, null, TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null);
        }
    }
    setNewTestCriteria(newTestCriteria);
}
Also used : TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) TestCriteriaNew(cbit.vcell.numericstest.TestCriteriaNew)

Aggregations

TestCriteriaNewBioModel (cbit.vcell.numericstest.TestCriteriaNewBioModel)9 TestCriteriaNewMathModel (cbit.vcell.numericstest.TestCriteriaNewMathModel)9 TestCriteriaNew (cbit.vcell.numericstest.TestCriteriaNew)5 SimulationInfo (cbit.vcell.solver.SimulationInfo)5 TestCaseNewBioModel (cbit.vcell.numericstest.TestCaseNewBioModel)4 TestCaseNewMathModel (cbit.vcell.numericstest.TestCaseNewMathModel)4 DataAccessException (org.vcell.util.DataAccessException)4 BioModelInfo (org.vcell.util.document.BioModelInfo)4 MathModelInfo (org.vcell.util.document.MathModelInfo)4 EditTestCriteriaOPBioModel (cbit.vcell.numericstest.EditTestCriteriaOPBioModel)3 EditTestCriteriaOPMathModel (cbit.vcell.numericstest.EditTestCriteriaOPMathModel)3 TestCaseNew (cbit.vcell.numericstest.TestCaseNew)3 TestSuiteNew (cbit.vcell.numericstest.TestSuiteNew)3 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)3 BioModel (cbit.vcell.biomodel.BioModel)2 MathModel (cbit.vcell.mathmodel.MathModel)2 AddTestCasesOPBioModel (cbit.vcell.numericstest.AddTestCasesOPBioModel)2 AddTestCasesOPMathModel (cbit.vcell.numericstest.AddTestCasesOPMathModel)2 AddTestCriteriaOPBioModel (cbit.vcell.numericstest.AddTestCriteriaOPBioModel)2 AddTestCriteriaOPMathModel (cbit.vcell.numericstest.AddTestCriteriaOPMathModel)2