Search in sources :

Example 1 with Sequence

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;
}
Also used : FilamentVariable(cbit.vcell.math.FilamentVariable) OutsideVariable(cbit.vcell.math.OutsideVariable) StochVolVariable(cbit.vcell.math.StochVolVariable) RandomVariable(cbit.vcell.math.RandomVariable) VolumeRandomVariable(cbit.vcell.math.VolumeRandomVariable) VolumeParticleVariable(cbit.vcell.math.VolumeParticleVariable) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) InsideVariable(cbit.vcell.math.InsideVariable) VolVariable(cbit.vcell.math.VolVariable) MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) PointVariable(cbit.vcell.math.PointVariable) MembraneRandomVariable(cbit.vcell.math.MembraneRandomVariable) MembraneParticleVariable(cbit.vcell.math.MembraneParticleVariable) ParticleVariable(cbit.vcell.math.ParticleVariable) MemVariable(cbit.vcell.math.MemVariable) FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) Variable(cbit.vcell.math.Variable) ObservableType(cbit.vcell.math.ParticleObservable.ObservableType) Element(org.jdom.Element) ParticleSpeciesPattern(cbit.vcell.math.ParticleSpeciesPattern) VolumeParticleSpeciesPattern(cbit.vcell.math.VolumeParticleSpeciesPattern) Sequence(cbit.vcell.math.ParticleObservable.Sequence) MembraneSubDomain(cbit.vcell.math.MembraneSubDomain) CompartmentSubDomain(cbit.vcell.math.CompartmentSubDomain) FilamentSubDomain(cbit.vcell.math.FilamentSubDomain) PointSubDomain(cbit.vcell.math.PointSubDomain) Domain(cbit.vcell.math.Variable.Domain) VolumeParticleObservable(cbit.vcell.math.VolumeParticleObservable)

Aggregations

CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)1 FilamentRegionVariable (cbit.vcell.math.FilamentRegionVariable)1 FilamentSubDomain (cbit.vcell.math.FilamentSubDomain)1 FilamentVariable (cbit.vcell.math.FilamentVariable)1 InsideVariable (cbit.vcell.math.InsideVariable)1 MemVariable (cbit.vcell.math.MemVariable)1 MembraneParticleVariable (cbit.vcell.math.MembraneParticleVariable)1 MembraneRandomVariable (cbit.vcell.math.MembraneRandomVariable)1 MembraneRegionVariable (cbit.vcell.math.MembraneRegionVariable)1 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)1 OutsideVariable (cbit.vcell.math.OutsideVariable)1 ObservableType (cbit.vcell.math.ParticleObservable.ObservableType)1 Sequence (cbit.vcell.math.ParticleObservable.Sequence)1 ParticleSpeciesPattern (cbit.vcell.math.ParticleSpeciesPattern)1 ParticleVariable (cbit.vcell.math.ParticleVariable)1 PointSubDomain (cbit.vcell.math.PointSubDomain)1 PointVariable (cbit.vcell.math.PointVariable)1 RandomVariable (cbit.vcell.math.RandomVariable)1 StochVolVariable (cbit.vcell.math.StochVolVariable)1 Variable (cbit.vcell.math.Variable)1