Пример #1
0
        public void SpeciesElement(Hashtable attrs)
        {
            Species species = new Species(this.model, attrs);

            SpeciesType speciesType = null;
            Compartment compartment = null;
            double initialAmount = 0;
            double initialConcentration = 0;
            String substanceUnits = null;
            Boolean hasOnlySubstanceUnits = false;
            Boolean boundaryCondition = false;
            Boolean constant = false;

            if (attrs.Contains("initialamount"))
            initialAmount = (double)(Double.Parse((String)attrs["initialamount"]));
            if (attrs.Contains("initialconcentration"))
            initialConcentration = (double)(Double.Parse((String)attrs["initialconcentration"]));
            if (attrs.Contains("substanceunits"))
            substanceUnits = (String)attrs["substanceunits"];
            if (attrs.Contains("hasonlysubstanceunits"))
            hasOnlySubstanceUnits = Boolean.Parse((String)attrs["hasonlysubstanceunits"]);
            if (attrs.Contains("boundarycondition"))
            boundaryCondition = Boolean.Parse((String)attrs["boundarycondition"]);
            if (attrs.Contains("constant"))
            constant = Boolean.Parse((String)attrs["constant"]);

            if (attrs.Contains("speciestype"))
            {
            String sTypeId = (String)attrs["speciesType"];
            speciesType = (SpeciesType)this.model.findObject(sTypeId);
            }

            if (attrs.Contains("compartment"))
            {
            String cId = (String)attrs["compartment"];
            compartment = (Compartment)this.model.findObject(cId);
            }

            if (attrs.Contains("substanceunits"))
            {
            substanceUnits = (String)attrs["substanceunits"];
            }
            else
            {
            // look it up based on units of compartment;
            }

            species.AddProperties(speciesType, compartment, initialAmount,
            initialConcentration, substanceUnits, hasOnlySubstanceUnits, boundaryCondition,
            constant);

            this.model.listOfSpecies.Add(species);
        }