use of cbit.vcell.math.ParticleMolecularTypePattern in project vcell by virtualcell.
the class XmlReader method getParticleMolecularTypePattern.
private ParticleMolecularTypePattern getParticleMolecularTypePattern(Element param, MathDescription mathDescription) throws XmlParseException {
String molecularTypeName = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
String matchLabel = unMangle(param.getAttributeValue(XMLTags.ParticleMolecularTypePatternMatchLabelAttrTag));
ParticleMolecularType particleMolecularType = mathDescription.getParticleMolecularType(molecularTypeName);
if (particleMolecularType != null) {
ParticleMolecularTypePattern var = new ParticleMolecularTypePattern(particleMolecularType);
if (matchLabel != null) {
var.setMatchLabel(matchLabel);
}
List<Element> componentPatternList = param.getChildren(XMLTags.ParticleMolecularComponentPatternTag, vcNamespace);
for (Element componentPattern : componentPatternList) {
ParticleMolecularComponentPattern p = getParticleMolecularComponentPattern(componentPattern, particleMolecularType);
var.addMolecularComponentPattern(p);
}
return var;
} else {
throw new XmlParseException("failed to find ParticleMolecularType named " + molecularTypeName);
}
}
use of cbit.vcell.math.ParticleMolecularTypePattern in project vcell by virtualcell.
the class NFsimXMLWriter method getObservableParticipantPattern.
private static Element getObservableParticipantPattern(String prefix0, String prefix1, VolumeParticleSpeciesPattern reactantSpeciesPattern, String patternElementName, ParticleObservable.Sequence sequence, Integer quantity) throws SolverException {
Element reactionParticipantPatternElement = new Element(patternElementName);
String patternID = prefix0 + "_" + prefix1;
reactionParticipantPatternElement.setAttribute("id", patternID);
// reactionParticipantPatternElement.setAttribute("name", reactantSpeciesPattern.getName());
if (sequence != ParticleObservable.Sequence.Multimolecular) {
String relation = sequence == ParticleObservable.Sequence.PolymerLengthEqual ? "==" : ">";
reactionParticipantPatternElement.setAttribute("relation", relation);
reactionParticipantPatternElement.setAttribute("quantity", quantity + "");
}
Element listOfMoleculesElement = new Element("ListOfMolecules");
HashMap<Bond, BondSites> bondSiteMapping = new HashMap<Bond, BondSites>();
for (int moleculeIndex = 0; moleculeIndex < reactantSpeciesPattern.getParticleMolecularTypePatterns().size(); moleculeIndex++) {
ParticleMolecularTypePattern molecularTypePattern = reactantSpeciesPattern.getParticleMolecularTypePatterns().get(moleculeIndex);
Element moleculeElement = new Element("Molecule");
String moleculeID = patternID + "_M" + (moleculeIndex + 1);
moleculeElement.setAttribute("id", moleculeID);
moleculeElement.setAttribute("name", molecularTypePattern.getMolecularType().getName());
Element listOfComponentsElement = getListOfComponents(moleculeID, reactantSpeciesPattern, molecularTypePattern, bondSiteMapping);
if (listOfComponentsElement != null) {
moleculeElement.addContent(listOfComponentsElement);
}
listOfMoleculesElement.addContent(moleculeElement);
}
reactionParticipantPatternElement.addContent(listOfMoleculesElement);
if (bondSiteMapping.size() > 0) {
Element listOfBondsElement = getListOfBonds(bondSiteMapping);
reactionParticipantPatternElement.addContent(listOfBondsElement);
}
return reactionParticipantPatternElement;
}
Aggregations