use of cbit.vcell.math.ParticleObservable.Sequence in project vcell by virtualcell.
the class XmlReader method getVolumeParticleObservable.
private VolumeParticleObservable getVolumeParticleObservable(Element param, VariableHash varHash) throws XmlParseException {
String name = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
String domainStr = unMangle(param.getAttributeValue(XMLTags.DomainAttrTag));
Domain domain = null;
if (domainStr != null) {
domain = new Domain(domainStr);
}
String molecularTypeString = unMangle(param.getAttributeValue(XMLTags.ParticleMolecularTypePatternTag));
ObservableType observableType = ObservableType.fromString(molecularTypeString);
VolumeParticleObservable var = new VolumeParticleObservable(name, domain, observableType);
String sequenceAttr = param.getAttributeValue(XMLTags.ParticleObservableSequenceTypeAttrTag);
if (sequenceAttr != null) {
Sequence sequence = Sequence.fromString(sequenceAttr);
String sequenceLength = param.getAttributeValue(XMLTags.ParticleObservableSequenceLengthAttrTag);
var.setSequence(sequence);
if (sequence != Sequence.Multimolecular) {
var.setQuantity(Integer.parseInt(sequenceLength));
}
} else {
var.setSequence(Sequence.Multimolecular);
}
Element volumeParticleSpeciesPatternsElement = param.getChild(XMLTags.VolumeParticleSpeciesPatternsTag, vcNamespace);
List<Element> volumeParticleSpeciesPatternList = volumeParticleSpeciesPatternsElement.getChildren(XMLTags.VolumeParticleSpeciesPatternTag, vcNamespace);
for (Element volumeParticleSpeciesPattern : volumeParticleSpeciesPatternList) {
String volumeParticleSpeciesPatternName = unMangle(volumeParticleSpeciesPattern.getAttributeValue(XMLTags.NameAttrTag));
Variable v = varHash.getVariable(volumeParticleSpeciesPatternName);
if (v == null) {
throw new XmlParseException("failed to find VolumeParticleSpeciesPattern named " + volumeParticleSpeciesPatternName);
}
if (v instanceof ParticleSpeciesPattern) {
var.addParticleSpeciesPattern((ParticleSpeciesPattern) v);
} else {
throw new XmlParseException("Variable " + volumeParticleSpeciesPatternName + " is not a ParticleSpeciesPattern");
}
}
return var;
}
Aggregations