use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.
the class MathDebuggerPanel method compareTree.
private void compareTree() throws PropertyVetoException, XmlParseException {
MathModel mathModel1 = getMathModel1();
MathModel mathModel2 = getMathModel2();
if (mathModel1 != null && mathModel2 != null) {
String math1XML = XmlHelper.mathModelToXML(mathModel1);
String math2XML = XmlHelper.mathModelToXML(mathModel2);
boolean ignoreVersion = true;
XmlTreeDiff diffTree = cbit.vcell.xml.XmlHelper.compareMerge(math1XML, math2XML, DiffConfiguration.COMPARE_DOCS_OTHER, ignoreVersion);
getTMLPanel().setXmlTreeDiff(diffTree);
} else {
DialogUtils.showErrorDialog(MathDebuggerPanel.this, "failed");
}
}
use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.
the class MathDebuggerPanel method flatten.
private void flatten(MathSymbolTableFactory mathSymbolTableFactory) throws PropertyVetoException, MathException, ExpressionException, MappingException, XmlParseException {
MathDescription math1 = getMathModel1().getMathDescription();
MathDescription newMath1 = MathDescription.createCanonicalMathDescription(mathSymbolTableFactory, math1);
MathModel newMathModel1 = new MathModel(null);
newMathModel1.setName("Math1");
newMathModel1.setMathDescription(newMath1);
setMathModel1(newMathModel1);
MathDescription math2 = getMathModel2().getMathDescription();
MathDescription newMath2 = MathDescription.createCanonicalMathDescription(mathSymbolTableFactory, math2);
MathModel newMathModel2 = new MathModel(null);
newMathModel2.setName("Math2");
newMathModel2.setMathDescription(newMath2);
setMathModel2(newMathModel2);
compareTree();
}
use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.
the class MathDebuggerPanel method getMathModel1.
public MathModel getMathModel1() throws PropertyVetoException {
MathDescription mathDesc = mathDescEditor1.getMathDescription();
if (mathDesc == null) {
return null;
} else {
MathModel mathModel = new MathModel(null);
mathModel.setName("MATH 1");
mathModel.setMathDescription(mathDesc);
return mathModel;
}
}
use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.
the class ClientDocumentManager method isChanged.
/**
* Insert the method's description here.
* Creation date: (10/28/00 12:08:30 AM)
*/
public boolean isChanged(MathModel mathModel, String mathModelXML) throws DataAccessException {
if (mathModel.getVersion() == null) {
//
return true;
} else {
//
if (!mathModel.getVersion().getName().equals(mathModel.getName())) {
return true;
}
//
if (!mathModel.getVersion().getAnnot().equals(mathModel.getDescription())) {
return true;
}
//
// check for same number of simulations as saved version
//
MathModelInfo savedMathModelInfo = getMathModelInfo(mathModel.getVersion().getVersionKey());
if (savedMathModelInfo == null) {
//
// if savedMathModelInfo is null, then the record was deleted
// while it was loaded in client (changed is true)
//
System.out.println("MathModel(" + mathModel.getVersion().getVersionKey() + ") must have been deleted, therefore isChanged() is true");
return true;
}
// MathModelMetaData savedMathModelMetaData = getMathModelMetaData(savedMathModelInfo);
// if (savedMathModelMetaData.getNumSimulations() != mathModel.getNumSimulations()){
// return true;
// }
//
// compare saved and this bioModel
//
XMLHolder<MathModel> savedMathModelXML = getMathModelXML(mathModel.getVersion().getVersionKey());
if (savedMathModelXML == null) {
// must have been deleted
return true;
}
try {
if (mathModelXML == null) {
mathModelXML = XmlHelper.mathModelToXML(mathModel);
}
return !VCMLComparator.compareEquals(savedMathModelXML.getXmlString(), mathModelXML, true);
} catch (XmlParseException e) {
e.printStackTrace(System.out);
throw new DataAccessException(e.getMessage());
}
}
}
use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.
the class ClientDocumentManager method getMathModelFromDatabaseXML.
/**
* Insert the method's description here.
* Creation date: (9/22/2004 5:22:40 PM)
* @return cbit.vcell.mathmodel.MathModel
* @param mathModelXML java.lang.String
*/
private MathModel getMathModelFromDatabaseXML(XMLHolder<MathModel> mathModelXML) throws DataAccessException {
try {
MathModel mm = mathModelXML.getDocument();
if (mm == null) {
mm = XmlHelper.XMLToMathModel(new XMLSource(mathModelXML.getXmlString()));
}
cacheSimulations(mm.getSimulations());
mm.refreshDependencies();
try {
if (mm.getMathDescription().getGeometry().getDimension() > 0 && mm.getMathDescription().getGeometry().getGeometrySurfaceDescription().getGeometricRegions() == null) {
mm.getMathDescription().getGeometry().getGeometrySurfaceDescription().updateAll();
}
} catch (Exception e) {
e.printStackTrace(System.out);
throw new DataAccessException("Geometric surface generation error:\n" + e.getMessage());
}
return mm;
} catch (XmlParseException e) {
e.printStackTrace();
throw new DataAccessException(e.getClass().getName() + ": " + e.getMessage());
}
}
Aggregations