Search in sources :

Example 76 with BioModelNode

use of cbit.vcell.desktop.BioModelNode in project vcell by virtualcell.

the class TestingFrmwkTreeModel method createTestCaseSubTree.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 1:06:51 PM)
 * @return cbit.vcell.desktop.BioModelNode
 * @param docManager cbit.vcell.clientdb.DocumentManager
 */
private BioModelNode createTestCaseSubTree(TestCaseNew testCase) throws DataAccessException {
    // 
    // add 'test case' node
    // 
    BioModelNode testCaseNode = new BioModelNode(testCase, true);
    TestCriteriaNew[] tCriteria = testCase.getTestCriterias();
    // Sort
    if (tCriteria != null && tCriteria.length > 0) {
        java.util.Arrays.sort(tCriteria, new java.util.Comparator<TestCriteriaNew>() {

            public int compare(TestCriteriaNew tc1, TestCriteriaNew tc2) {
                return tc1.getSimInfo().getVersion().getName().compareTo(tc2.getSimInfo().getVersion().getName());
            }

            public boolean equals(Object obj) {
                return false;
            }
        });
        // 
        // False => sim has not been run; True => for a regression test, the ref SimInfo is not set.
        boolean bRefSimNull = false;
        for (int t = 0; t < tCriteria.length; t += 1) {
            TestCriteriaNew tcInfo = tCriteria[t];
            BioModelNode simInfoNode = new BioModelNode(tcInfo, true);
            String tcInfoStr = null;
            if (tcInfo != null) {
                tcInfoStr = "TestCriteria : LimitAbsError = " + tcInfo.getMaxAbsError() + "; LimitRelError = " + tcInfo.getMaxRelError() + "; ";
                if (testCase.getType().equals(TestCaseNew.REGRESSION)) {
                    if (tcInfo.getRegressionSimInfo() != null) {
                        SimulationInfo refSimInfo = tcInfo.getRegressionSimInfo();
                        if (refSimInfo != null) {
                            if (tcInfo instanceof TestCriteriaNewMathModel) {
                                tcInfoStr = tcInfoStr + "MathModel : " + ((TestCriteriaNewMathModel) tcInfo).getRegressionMathModelInfo().getVersion().getName() + "; ";
                                tcInfoStr = tcInfoStr + "SimInfo : " + refSimInfo.getName();
                            } else if (tcInfo instanceof TestCriteriaNewBioModel) {
                                tcInfoStr = tcInfoStr + "BioModel : " + ((TestCriteriaNewBioModel) tcInfo).getRegressionBioModelInfo().getVersion().getName() + "; ";
                                tcInfoStr = tcInfoStr + "SimInfo : " + refSimInfo.getName();
                            }
                        }
                    } else {
                        tcInfoStr = tcInfoStr + " REFERENCE SIMULATION NOT SET YET";
                        bRefSimNull = true;
                    }
                }
                BioModelNode testCriteriaNode = new BioModelNode(tcInfoStr, false);
                simInfoNode.add(testCriteriaNode);
            }
            // Add sim results if present (by adding the reportInfo subtree ...)
            BioModelNode reportInfoNode = createSimulationSubTree(tcInfo, simInfoNode, bRefSimNull);
            if (reportInfoNode != null) {
                simInfoNode.add(reportInfoNode);
            }
            testCaseNode.add(simInfoNode);
        }
    }
    return testCaseNode;
}
Also used : TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) TestCriteriaNew(cbit.vcell.numericstest.TestCriteriaNew) BioModelNode(cbit.vcell.desktop.BioModelNode) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 77 with BioModelNode

use of cbit.vcell.desktop.BioModelNode in project vcell by virtualcell.

the class TestingFrmwkTreeModel method refreshTree.

// public void refreshTree(LoadTestInfoOpResults loadTestInfoOpResults) {
// BioModelNode rootNode = getLoadTestRoot();
// //Create Load Test Info Tree
// BioModelNode loadTestInfoNode = new BioModelNode(TestingFrmwkTreeModel.LOAD_TEST_INFO_NAME, true);
// for (int i = 0; i < loadTestInfoOpResults.getLoadTestSoftwareVersionTimeStamps().length; i++) {
// LoadTestTreeInfo loadTestTreeInfo = new LoadTestTreeInfo();
// loadTestTreeInfo.loadTestSoftwareVersionTimeStamp = loadTestInfoOpResults.getLoadTestSoftwareVersionTimeStamps()[i];
// loadTestTreeInfo.userid = null;
// loadTestTreeInfo.bioOrMathModelKey = null;
// String progress = "";
// if(loadTestInfoOpResults.getLoadTestInfoEmptyCounts()[i] != null){
// double progPercent =
// (double)(loadTestInfoOpResults.getLoadTestInfoCounts()[i]-loadTestInfoOpResults.getLoadTestInfoEmptyCounts()[i])/
// (double)loadTestInfoOpResults.getLoadTestInfoCounts()[i];
// progress = " [working "+NumberUtils.formatNumber(progPercent*100, 3)+"%]";
// }
// loadTestTreeInfo.treeDisplayText =
// loadTestInfoOpResults.getLoadTestSoftwareVersionTimeStamps()[i].getSoftwareVersion()+
// " "+loadTestInfoOpResults.getLoadTestSoftwareVersionTimeStamps()[i].getRunTimeStamp()+
// " "+loadTestInfoOpResults.getLoadTestInfoCounts()[i]+" ("+
// loadTestInfoOpResults.getTotalBioAndMathmodelCount()+")"+
// progress;
// 
// BioModelNode infoNode =
// new BioModelNode(loadTestTreeInfo,false);
// loadTestInfoNode.add(infoNode);
// }
// for (int i = 0; i < rootNode.getChildCount(); i++) {
// BioModelNode childNode = (BioModelNode)rootNode.getChildAt(i);
// if(childNode.getUserObject().equals(TestingFrmwkTreeModel.LOAD_TEST_INFO_NAME)){
// removeNodeFromParent(childNode);
// insertNodeInto(loadTestInfoNode, rootNode, i);
// }
// }
// 
// //Create Load Test failed tree
// BioModelNode loadTestFailNode = new BioModelNode(TestingFrmwkTreeModel.LOAD_TEST_FAIL_NAME, true);
// Enumeration<LoadTestSoftwareVersionTimeStamp> failEnum = loadTestInfoOpResults.getLoadTestFailedHash().keys();
// while(failEnum.hasMoreElements()){
// LoadTestSoftwareVersionTimeStamp loadTestSoftwareVersionTimeStamp =
// failEnum.nextElement();
// Vector<LoadTestFailedDetails> faildetailsV = loadTestInfoOpResults.getLoadTestFailedHash().get(loadTestSoftwareVersionTimeStamp);
// BioModelNode loadTestSoftwareVersionTimeStampNode =
// new BioModelNode("("+faildetailsV.size()+") "+loadTestSoftwareVersionTimeStamp.getSoftwareVersion()+" "+
// loadTestSoftwareVersionTimeStamp.getRunTimeStamp(),true);
// loadTestFailNode.add(loadTestSoftwareVersionTimeStampNode);
// LoadTestFailedDetails[] sortedDetails = faildetailsV.toArray(new LoadTestFailedDetails[0]);
// Arrays.sort(sortedDetails,new Comparator<LoadTestFailedDetails>() {
// public int compare(LoadTestFailedDetails o1, LoadTestFailedDetails o2) {
// // TODO Auto-generated method stub
// return o1.errorMessage.compareToIgnoreCase(o2.errorMessage);
// }
// });
// for (int i = 0; i < sortedDetails.length; i++) {
// LoadTestTreeInfo loadTestTreeInfo = new LoadTestTreeInfo();
// loadTestTreeInfo.loadTestSoftwareVersionTimeStamp = loadTestSoftwareVersionTimeStamp;
// loadTestTreeInfo.userid = sortedDetails[i].userid;
// loadTestTreeInfo.bioOrMathModelKey = sortedDetails[i].modelKeyValue;
// loadTestTreeInfo.treeDisplayText =
// sortedDetails[i].userid+" ["+sortedDetails[i].modelType+"] '"+
// sortedDetails[i].modelName+"'     "+sortedDetails[i].errorMessage;
// 
// BioModelNode detailNode = new BioModelNode(loadTestTreeInfo, false);
// loadTestSoftwareVersionTimeStampNode.add(detailNode);
// }
// 
// 
// }
// for (int i = 0; i < rootNode.getChildCount(); i++) {
// BioModelNode childNode = (BioModelNode)rootNode.getChildAt(i);
// if(childNode.getUserObject().equals(TestingFrmwkTreeModel.LOAD_TEST_FAIL_NAME)){
// removeNodeFromParent(childNode);
// insertNodeInto(loadTestFailNode, rootNode, i);
// //			firePropertyChange(TS_NODE_REFRESH, childNode, finalNode);
// }
// }
// 
// }
/**
 * Insert the method's description here.
 * Creation date: (2/14/01 3:50:24 PM)
 */
public void refreshTree(final TestSuiteInfoNew tsin) {
    if (getDocumentManager() != null && getDocumentManager().getUser() != null) {
        if (getDocumentManager().getUser().isTestAccount()) {
            AsynchClientTask GetTestSuites = new AsynchClientTask("Refresh Testing FrameWork Display", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

                @Override
                public void run(Hashtable<String, Object> hashTable) throws Exception {
                    TestSuiteGroup tsg = new TestSuiteGroup();
                    boolean bRemove = false;
                    try {
                        TestSuiteInfoNew[] latestTestSuiteInfos = null;
                        TestSuiteNew latestTestSuite = null;
                        boolean hadUpdateTSError = false;
                        if (getDocumentManager() != null) {
                            TestSuiteInfoNew[] testSuiteInfos = null;
                            getClientTaskStatusSupport().setMessage("Getting TestsuiteInfos");
                            try {
                                testSuiteInfos = getDocumentManager().getTestSuiteInfos();
                            } catch (Throwable e) {
                                e.printStackTrace();
                                hadUpdateTSError = true;
                            }
                            if (testSuiteInfos != null) {
                                latestTestSuiteInfos = testSuiteInfos;
                                if (tsin != null) {
                                    try {
                                        getClientTaskStatusSupport().setProgress(50);
                                        if (tsin.getTSKey() != null) {
                                            // from Refesh or remove TestSuite
                                            bRemove = true;
                                            for (int i = 0; i < testSuiteInfos.length; i++) {
                                                if (testSuiteInfos[i].getTSKey().equals(tsin.getTSKey())) {
                                                    bRemove = false;
                                                    break;
                                                }
                                            }
                                            if (!bRemove) {
                                                getClientTaskStatusSupport().setMessage("Getting Testsuite " + tsin.getTSID());
                                                latestTestSuite = getDocumentManager().getTestSuite(tsin.getTSKey());
                                            } else {
                                                getClientTaskStatusSupport().setMessage("Remove Testsuite " + tsin.getTSID());
                                                latestTestSuiteInfos = new TestSuiteInfoNew[] { tsin };
                                            }
                                        } else {
                                            // from Duplicate TestSuite
                                            for (int i = 0; i < testSuiteInfos.length; i++) {
                                                if (testSuiteInfos[i].getTSID().equals(tsin.getTSID())) {
                                                    latestTestSuite = getDocumentManager().getTestSuite(testSuiteInfos[i].getTSKey());
                                                    break;
                                                }
                                            }
                                        }
                                    } catch (DataAccessException e) {
                                        tsg = new TestSuiteGroup();
                                        throw e;
                                    }
                                }
                            }
                        }
                        tsg.latestTestSuiteInfos = latestTestSuiteInfos;
                        tsg.latestTestSuite = latestTestSuite;
                        tsg.hadUpdateTSError = hadUpdateTSError;
                    } finally {
                        if (tsg.latestTestSuiteInfos != null) {
                            getClientTaskStatusSupport().setProgress(tsg.latestTestSuiteInfos.length * 100 / (tsg.latestTestSuiteInfos.length + 1));
                        }
                        hashTable.put("tsg", tsg);
                        hashTable.put("bRemove", bRemove);
                    }
                }
            };
            AsynchClientTask updateTreeTask = new AsynchClientTask("Refresh Testing FrameWork Display", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

                @Override
                public void run(Hashtable<String, Object> hashTable) throws Exception {
                    TestSuiteGroup tsg = (TestSuiteGroup) hashTable.get("tsg");
                    boolean bRemove = (Boolean) hashTable.get("bRemove");
                    updateTree(tsg, bRemove);
                }
            };
            ClientTaskDispatcher.dispatch(treeOwner.getParent(), new Hashtable<String, Object>(), new AsynchClientTask[] { GetTestSuites, updateTreeTask }, false);
        } else {
            setRoot(new BioModelNode(getDocumentManager().getUser().getName() + " Not TestAccount User"));
        }
    } else {
        setRoot(new BioModelNode("empty"));
    }
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) TestSuiteNew(cbit.vcell.numericstest.TestSuiteNew) Hashtable(java.util.Hashtable) BioModelNode(cbit.vcell.desktop.BioModelNode) TestSuiteInfoNew(cbit.vcell.numericstest.TestSuiteInfoNew) DataAccessException(org.vcell.util.DataAccessException)

Example 78 with BioModelNode

use of cbit.vcell.desktop.BioModelNode in project vcell by virtualcell.

the class TestingFrmwkTreeModel method createSimulationSubTree.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 1:06:51 PM)
 * @return cbit.vcell.desktop.BioModelNode
 * @param docManager cbit.vcell.clientdb.DocumentManager
 */
private BioModelNode createSimulationSubTree(TestCriteriaNew tcInfo, BioModelNode simInfoNode, boolean refSimNull) throws DataAccessException {
    // 
    // add 'reportInfo' node (with nodes for status and comparison summaries for variables) - sim results
    // 
    VariableComparisonSummary[] varCompSummaries = tcInfo.getVarComparisonSummaries();
    BioModelNode reportInfoNode = null;
    boolean hasFailedVars = false;
    if (tcInfo != null) {
        // Calculate actual MAE,MRE
        double actualMAE = Double.NEGATIVE_INFINITY;
        double actualMRE = Double.NEGATIVE_INFINITY;
        if (varCompSummaries != null) {
            for (int i = 0; i < varCompSummaries.length; i++) {
                VariableComparisonSummary var1 = varCompSummaries[i];
                actualMAE = Math.max(actualMAE, var1.getAbsoluteError().doubleValue());
                actualMRE = Math.max(actualMRE, var1.getRelativeError().doubleValue());
            }
            reportInfoNode = new BioModelNode("Report Info: maxActualMAE=" + actualMAE + " maxActualMRE=" + actualMRE, true);
            // reportInfoNode.add(new BioModelNode("TBI", false));
            for (int i = 0; i < varCompSummaries.length; i++) {
                // For each Variable, get the corresponding varComparisonSummary,
                // Create a node varNode for varName, minRef,maxRef.
                // Create nodes for errors and add them as children to varNode
                // To enhance readability of errors in ResultSetsubtree on panel ...
                VariableComparisonSummary var1 = varCompSummaries[i];
                TestCriteriaVarUserObj tcritVarUserObj = new TestCriteriaVarUserObj(tcInfo, var1);
                // String varInfo = "Var = " + var1.getName() + " MAE = " + var1.getAbsoluteError() + " MRE = " + var1.getRelativeError();
                BioModelNode varInfoNode = new BioModelNode(tcritVarUserObj, true);
                if (VariableComparisonSummary.isFailed(var1)) {
                    varInfoNode.setRenderHint(FAILED_VARIABLE_MAE_MRE, Boolean.TRUE);
                    hasFailedVars = true;
                }
                String varInfo = "Mean Square Error = " + var1.getMeanSqError();
                varInfoNode.add(new cbit.vcell.desktop.BioModelNode(varInfo, false));
                varInfo = "minRef = " + var1.getMinRef();
                varInfoNode.add(new cbit.vcell.desktop.BioModelNode(varInfo, false));
                varInfo = "maxRef = " + var1.getMaxRef();
                varInfoNode.add(new cbit.vcell.desktop.BioModelNode(varInfo, false));
                varInfo = "timeAbsError = " + var1.getTimeAbsoluteError();
                varInfoNode.add(new cbit.vcell.desktop.BioModelNode(varInfo, false));
                varInfo = "indexAbsError = " + var1.getIndexAbsoluteError();
                varInfoNode.add(new cbit.vcell.desktop.BioModelNode(varInfo, false));
                varInfo = "timeRelError = " + var1.getTimeRelativeError();
                varInfoNode.add(new cbit.vcell.desktop.BioModelNode(varInfo, false));
                varInfo = "indexRelError = " + var1.getIndexRelativeError();
                varInfoNode.add(new cbit.vcell.desktop.BioModelNode(varInfo, false));
                reportInfoNode.add(varInfoNode);
            }
            if (hasFailedVars) {
                reportInfoNode.insert(new BioModelNode("FAILED", false), 0);
            } else {
                reportInfoNode.insert(new BioModelNode("PASSED", false), 0);
            }
        } else {
            String status = "NO DATA";
            if (refSimNull) {
                status = status + " : REFERENCE SIMULATION NOT SPECIFIED";
            }
            reportInfoNode = new BioModelNode(status, false);
            reportInfoNode.setRenderHint(SIMULATIONS_NO_REPORT, Boolean.TRUE);
        }
    }
    if (hasFailedVars) {
        simInfoNode.setRenderHint(FAILED_VARIABLE_MAE_MRE, Boolean.TRUE);
    } else {
        simInfoNode.setRenderHint(FAILED_VARIABLE_MAE_MRE, Boolean.FALSE);
    }
    return reportInfoNode;
}
Also used : BioModelNode(cbit.vcell.desktop.BioModelNode) BioModelNode(cbit.vcell.desktop.BioModelNode) VariableComparisonSummary(cbit.vcell.solver.test.VariableComparisonSummary)

Example 79 with BioModelNode

use of cbit.vcell.desktop.BioModelNode in project vcell by virtualcell.

the class TestingFrmwkTreeModel method createTestSuiteTree.

private synchronized BioModelNode createTestSuiteTree(TestSuiteGroup tsg) throws DataAccessException, java.io.IOException, org.jdom.JDOMException {
    boolean isTFUser = getDocumentManager().getUser().isTestAccount();
    if (isTFUser && tsg != null && !tsg.hadUpdateTSError) {
        BioModelNode rootRootNode = new BioModelNode(TEST_SUITE_SUBTREE_NAME, true);
        // }else
        if (tsg.latestTestSuiteInfos != null) {
            Arrays.sort(tsg.latestTestSuiteInfos, new Comparator<TestSuiteInfoNew>() {

                public int compare(TestSuiteInfoNew o1, TestSuiteInfoNew o2) {
                    return o1.getTSDate().compareTo(o2.getTSDate());
                }
            });
            for (int i = 0; i < tsg.latestTestSuiteInfos.length; i++) {
                BioModelNode tsNodeNoDetail = new BioModelNode(tsg.latestTestSuiteInfos[i], true);
                tsNodeNoDetail.add(new BioModelNode(null, false));
                rootRootNode.add(tsNodeNoDetail);
            }
        }
        return rootRootNode;
    } else {
        BioModelNode rootRootNode = new BioModelNode("No TestSuites" + (!isTFUser ? " - Not TFuser" : "") + (tsg.hadUpdateTSError ? " ERROR" : ""), false);
        return rootRootNode;
    }
}
Also used : BioModelNode(cbit.vcell.desktop.BioModelNode) TestSuiteInfoNew(cbit.vcell.numericstest.TestSuiteInfoNew)

Example 80 with BioModelNode

use of cbit.vcell.desktop.BioModelNode in project vcell by virtualcell.

the class TestingFrmwkTreeModel method createTestSuiteSubTree.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 1:06:51 PM)
 * @return cbit.vcell.desktop.BioModelNode
 * @param docManager cbit.vcell.clientdb.DocumentManager
 */
private BioModelNode createTestSuiteSubTree(TestSuiteNew testSuite) throws DataAccessException, java.io.IOException, org.jdom.JDOMException {
    TestCaseNew[] testCases = testSuite.getTestCases();
    BioModelNode rootNode = new BioModelNode(testSuite.getTSInfoNew(), true);
    if (testCases != null && testCases.length > 0) {
        for (int i = 0; i < testCases.length; i++) {
            rootNode.add(createTestCaseSubTree(testCases[i]));
        }
    }
    return rootNode;
}
Also used : BioModelNode(cbit.vcell.desktop.BioModelNode) TestCaseNew(cbit.vcell.numericstest.TestCaseNew)

Aggregations

BioModelNode (cbit.vcell.desktop.BioModelNode)82 TreePath (javax.swing.tree.TreePath)22 MolecularComponent (org.vcell.model.rbm.MolecularComponent)17 CSGObject (cbit.vcell.geometry.CSGObject)12 MolecularTypePattern (org.vcell.model.rbm.MolecularTypePattern)11 SimulationContext (cbit.vcell.mapping.SimulationContext)10 MolecularType (org.vcell.model.rbm.MolecularType)10 Point (java.awt.Point)9 Icon (javax.swing.Icon)8 ComponentStateDefinition (org.vcell.model.rbm.ComponentStateDefinition)8 TestSuiteInfoNew (cbit.vcell.numericstest.TestSuiteInfoNew)7 TreeNode (javax.swing.tree.TreeNode)7 DocumentEditorTreeFolderClass (cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass)6 DocumentEditorTreeFolderNode (cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode)6 TestCaseNew (cbit.vcell.numericstest.TestCaseNew)6 TestCriteriaNew (cbit.vcell.numericstest.TestCriteriaNew)6 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)6 BioPaxObject (org.vcell.pathway.BioPaxObject)6 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)5 Component (java.awt.Component)5