use of cbit.vcell.math.ParticleProperties.ParticleInitialConditionCount in project vcell by virtualcell.
the class Xmlproducer method getXML.
private org.jdom.Element getXML(ParticleProperties param) throws XmlParseException {
org.jdom.Element particleProperties = new org.jdom.Element(XMLTags.ParticlePropertiesTag);
particleProperties.setAttribute(XMLTags.NameAttrTag, mangle(param.getVariable().getName()));
for (ParticleInitialCondition pic : param.getParticleInitialConditions()) {
org.jdom.Element particleInitial = null;
if (pic instanceof ParticleInitialConditionCount) {
particleInitial = new org.jdom.Element(XMLTags.ParticleInitialCountTag);
ParticleInitialConditionCount ppic = (ParticleInitialConditionCount) pic;
Element e = new Element(XMLTags.ParticleCountTag);
e.setText(mangleExpression(ppic.getCount()));
particleInitial.addContent(e);
if (ppic.getLocationX() != null) {
e = new Element(XMLTags.ParticleLocationXTag);
e.setText(mangleExpression(ppic.getLocationX()));
particleInitial.addContent(e);
}
if (ppic.getLocationY() != null) {
e = new Element(XMLTags.ParticleLocationYTag);
e.setText(mangleExpression(ppic.getLocationY()));
particleInitial.addContent(e);
}
if (ppic.getLocationZ() != null) {
e = new Element(XMLTags.ParticleLocationZTag);
e.setText(mangleExpression(ppic.getLocationZ()));
particleInitial.addContent(e);
}
} else if (pic instanceof ParticleInitialConditionConcentration) {
particleInitial = new org.jdom.Element(XMLTags.ParticleInitialConcentrationTag);
ParticleInitialConditionConcentration ppic = (ParticleInitialConditionConcentration) pic;
Element e = new Element(XMLTags.ParticleDistributionTag);
e.setText(mangleExpression(ppic.getDistribution()));
particleInitial.addContent(e);
}
particleProperties.addContent(particleInitial);
}
Element diff = new Element(XMLTags.ParticleDiffusionTag);
diff.setText(mangleExpression(param.getDiffusion()));
particleProperties.addContent(diff);
if (param.getDriftX() != null) {
Element driftX = new Element(XMLTags.ParticleDriftXTag);
driftX.setText(mangleExpression(param.getDriftX()));
particleProperties.addContent(driftX);
}
if (param.getDriftY() != null) {
Element driftY = new Element(XMLTags.ParticleDriftYTag);
driftY.setText(mangleExpression(param.getDriftY()));
particleProperties.addContent(driftY);
}
if (param.getDriftZ() != null) {
Element driftZ = new Element(XMLTags.ParticleDriftZTag);
driftZ.setText(mangleExpression(param.getDriftZ()));
particleProperties.addContent(driftZ);
}
return particleProperties;
}
Aggregations