Example #1
0
        public virtual void TestParseInvalidAttributesWithDifferentUnitsAndTypes()
        {
            XmlNode          node             = CreateNode("<something value=\"1234.45\" unit=\"xyzabc\" />");
            PhysicalQuantity physicalQuantity = (PhysicalQuantity) new PqElementParser().Parse(CreateContext("PQ.BASIC", SpecificationVersion
                                                                                                             .V02R02), node, this.xmlResult).BareValue;

            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.IsNull(physicalQuantity.Unit, "unit");
            node             = CreateNode("<something value=\"1234.45\" unit=\"mo\" />");
            physicalQuantity = (PhysicalQuantity) new PqElementParser().Parse(CreateContext("PQ.DRUG", SpecificationVersion.V02R02), node
                                                                              , this.xmlResult).BareValue;
            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.IsNull(physicalQuantity.Unit, "unit");
            node             = CreateNode("<something value=\"1234.45\" unit=\"kg\" />");
            physicalQuantity = (PhysicalQuantity) new PqElementParser().Parse(CreateContext("PQ.TIME", SpecificationVersion.V02R02), node
                                                                              , this.xmlResult).BareValue;
            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.IsNull(physicalQuantity.Unit, "unit");
            node             = CreateNode("<something value=\"1234.45\" unit=\"mo\" />");
            physicalQuantity = (PhysicalQuantity) new PqElementParser().Parse(CreateContext("PQ.HEIGHTWEIGHT", SpecificationVersion.V02R02
                                                                                            ), node, this.xmlResult).BareValue;
            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.IsNull(physicalQuantity.Unit, "unit");
            node             = CreateNode("<something value=\"1234.45\" unit=\"mo\" />");
            physicalQuantity = (PhysicalQuantity) new PqElementParser().Parse(CreateContext("PQ.DISTANCE", SpecificationVersion.V02R02
                                                                                            ), node, this.xmlResult).BareValue;
            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.IsNull(physicalQuantity.Unit, "unit");
        }
Example #2
0
 protected ProcessVar(string name, PhysicalQuantity type, VarState state, IProcessVarOwner owner) : base()
 {
     this.name  = name;
     this.type  = type;
     this.state = state;
     this.owner = owner;
 }
Example #3
0
        /// <summary>
        /// Evaluates the operator on scalar operands.
        /// </summary>
        /// <param name="Operand">Operand.</param>
        /// <param name="Variables">Variables collection.</param>
        /// <returns>Result</returns>
        public override IElement EvaluateScalar(IElement Operand, Variables Variables)
        {
            DoubleNumber D = Operand as DoubleNumber;

            if (!(D is null))
            {
                return(new PhysicalQuantity(D.Value, this.unit));
            }

            PhysicalQuantity Q = Operand as PhysicalQuantity;

            if (!(Q is null))
            {
                double Magnitude;

                if (Unit.TryConvert(Q.Magnitude, Q.Unit, this.unit, out Magnitude))
                {
                    return(new PhysicalQuantity(Magnitude, this.unit));
                }
                else
                {
                    throw new ScriptRuntimeException("Unable to convert from " + Q.Unit.ToString() + " to " + this.unit.ToString() + ".", this);
                }
            }

            throw new ScriptRuntimeException("Unable to set physical unit.", this);
        }
Example #4
0
 protected ProcessVar(string name, PhysicalQuantity type, VarState state)
     : base()
 {
     this.name  = name;
     this.type  = type;
     this.state = state;
 }
Example #5
0
 private void CheckDenominator(Ratio <N, D> result, bool denominatorFound, XmlNode node, ParseContext context, XmlToModelResult
                               xmlToModelResult)
 {
     if (denominatorFound)
     {
         if (result.Denominator is PhysicalQuantity)
         {
             PhysicalQuantity pqDenominator = (PhysicalQuantity)(object)result.Denominator;
             //cast to Object for .NET translation
             if (BigDecimal.ZERO.Equals(pqDenominator.Quantity))
             {
                 RecordError("Denominator value can not be zero.", context, node, xmlToModelResult);
             }
             else
             {
                 if (pqDenominator.Quantity == null)
                 {
                     // schema states that the pq values default to "1", without reference to which property; assuming this to mean quantity
                     pqDenominator.Quantity = BigDecimal.ONE;
                 }
             }
         }
     }
     else
     {
         RecordMissingElementError("Denominator", context, node, xmlToModelResult);
     }
 }
Example #6
0
        public virtual void TestPivlPhasePeriod()
        {
            XmlToModelResult result = new XmlToModelResult();
            XmlNode          node   = CreateNode("<pivl><period unit=\"d\" value=\"1\"/><phase><low value=\"20120503\"/><high value=\"20120708\"/></phase></pivl>"
                                                 );
            ParseContext context = ParseContextImpl.Create("PIVLTSCDAR1", null, SpecificationVersion.R02_04_03, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                           .MANDATORY, Cardinality.Create("1"), null, true);
            BareANY          parseResult    = this.parser.Parse(context, Arrays.AsList(node), result);
            PhysicalQuantity expectedPeriod = new PhysicalQuantity(BigDecimal.ONE, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                                   .DAY);
            PlatformDate            dateLow             = DateUtil.GetDate(2012, 4, 3);
            DateWithPattern         dateWithPatternLow  = new DateWithPattern(dateLow, "yyyyMMdd");
            PlatformDate            dateHigh            = DateUtil.GetDate(2012, 6, 8);
            DateWithPattern         dateWithPatternHigh = new DateWithPattern(dateHigh, "yyyyMMdd");
            Interval <PlatformDate> expectedPhase       = IntervalFactory.CreateLowHigh((PlatformDate)dateWithPatternLow, (PlatformDate)dateWithPatternHigh
                                                                                        );

            Assert.IsTrue(result.IsValid());
            Assert.IsTrue(parseResult is PIVLTSCDAR1);
            PeriodicIntervalTimeR2 pivl = (PeriodicIntervalTimeR2)parseResult.BareValue;

            Assert.AreEqual(expectedPeriod.Quantity, pivl.Period.Quantity);
            Assert.AreEqual(expectedPeriod.Unit.CodeValue, pivl.Period.Unit.CodeValue);
            Assert.AreEqual(expectedPhase, pivl.Phase);
            Assert.IsNull(pivl.FrequencyRepetitions);
            Assert.IsNull(pivl.FrequencyQuantity);
        }
Example #7
0
        protected virtual PeriodicIntervalTime ParseFrequency(ParseContext context, XmlElement element, Type expectedReturnType,
                                                              XmlToModelResult xmlToModelResult)
        {
            XmlElement numerator   = (XmlElement)GetNamedChildNode(element, "numerator");
            XmlElement denominator = (XmlElement)GetNamedChildNode(element, "denominator");

            if (numerator != null && denominator != null)
            {
                Int32?repetitions = ParseNumerator(context, numerator, xmlToModelResult);
                if (SpecificationVersion.IsExactVersion(SpecificationVersion.V01R04_2_SK, context.GetVersion()))
                {
                    Interval <PhysicalQuantity> quantityInterval = ParseDenominatorSk(context, denominator, xmlToModelResult);
                    return(PeriodicIntervalTimeSk.CreateFrequencySk(repetitions, quantityInterval == null ? null : quantityInterval.Low, quantityInterval
                                                                    == null ? null : quantityInterval.High));
                }
                else
                {
                    PhysicalQuantity quantity = ParseDenominator(context, denominator, xmlToModelResult);
                    return(PeriodicIntervalTime.CreateFrequency(repetitions, quantity));
                }
            }
            else
            {
                if (numerator == null)
                {
                    CreateMandatoryChildElementHl7Error(element, "numerator", xmlToModelResult);
                }
                if (denominator == null)
                {
                    CreateMandatoryChildElementHl7Error(element, "denominator", xmlToModelResult);
                }
                return(null);
            }
        }
Example #8
0
 public CurveF(string name, float val, PointF[] data)
 {
     this.name = name;
     this.val  = val;
     this.pq   = pq;
     this.data = data;
 }
Example #9
0
        private static PhysicalQuantity AddPhysicalQuantity(PhysicalQuantity q1,
                                                            PhysicalQuantity q2)
        {
            // Units must be the same in order to be added (though an argument can be made that we
            // could be smart about unit types that can be converted to each other).

            // Redmine 11271 - special case: if both units are null then the add will be allowed to go through as if the two values had the same units

            Boolean unitsBothNull     = (q1.Unit == null && q2.Unit == null);
            Boolean unitsBothProvided = (q1.Unit != null && q2.Unit != null);

            if (unitsBothNull || (unitsBothProvided && StringUtils.Equals(q1.Unit.CodeValue, q2.Unit.CodeValue)))
            {
                return(new PhysicalQuantity(Add(q1.Quantity, q2.Quantity), q1.Unit));
            }
            else
            {
                //Fix for exception msg.  Null Reference Exception otherwise.
                string q1Units = (q1.Unit == null ? "" : q1.Unit.CodeValue);
                string q2Units = (q2.Unit == null ? "" : q2.Unit.CodeValue);

                throw new ArgumentException(
                          "Can't add two quantities of different units: "
                          + q1Units + " and " + q2Units);
            }
        }
Example #10
0
        /// <summary>
        /// Gets label values for a series vector.
        /// </summary>
        /// <param name="Min">Smallest value.</param>
        /// <param name="Max">Largest value.</param>
        /// <param name="ApproxNrLabels">Number of labels.</param>
        /// <returns>Vector of labels.</returns>
        public static PhysicalQuantity[] GetLabels(PhysicalQuantity Min, PhysicalQuantity Max, int ApproxNrLabels)
        {
            double MinValue = Min.Magnitude;
            double MaxValue;
            Unit   Unit = Min.Unit;

            if (!Min.Unit.Equals(Max.Unit))
            {
                if (!Unit.TryConvert(Max.Magnitude, Max.Unit, Unit, out MaxValue))
                {
                    throw new ScriptException("Incompatible units.");
                }
            }
            else
            {
                MaxValue = Max.Magnitude;
            }

            double[] Labels = GetLabels(MinValue, MaxValue, ApproxNrLabels);
            int      i, c = Labels.Length;

            PhysicalQuantity[] Result = new PhysicalQuantity[c];

            for (i = 0; i < c; i++)
            {
                Result[i] = new PhysicalQuantity(Labels[i], Unit);
            }

            return(Result);
        }
Example #11
0
        public virtual void TestFormatPhysicalQuantityValidWithTranslations()
        {
            CodedTypeR2 <Code> translation1 = new CodedTypeR2 <Code>();

            translation1.Code = Ca.Infoway.Messagebuilder.Domainvalue.Payload.AdministrativeGender.MALE;
            CodedTypeR2 <Code> translation2 = new CodedTypeR2 <Code>();

            translation2.Code = Ca.Infoway.Messagebuilder.Domainvalue.Controlact.ActStatus.ACTIVE;
            string quantity = "33.45";

            Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive unit = CeRxDomainTestValues.ENZYME_UNIT_MICROMOLES_MINUTE_PER_LITRE;
            PhysicalQuantity physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Quantity = new BigDecimal(quantity);
            physicalQuantity.Unit     = unit;
            physicalQuantity.Translation.Add(translation1);
            physicalQuantity.Translation.Add(translation2);
            IDictionary <string, string> result = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (CreateContext("PQ"), physicalQuantity, null);

            Assert.AreEqual(2, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("value"), "key as expected");
            Assert.AreEqual(quantity, result.SafeGet("value"), "value");
            Assert.IsTrue(result.ContainsKey("unit"), "unit key as expected");
            Assert.AreEqual(unit.CodeValue, result.SafeGet("unit"), "unit");
            string xml = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().Format(CreateContext("PQ"), new PQImpl(physicalQuantity
                                                                                                                              ), 0);

            AssertXml("should see translations", "<name unit=\"U/L\" value=\"33.45\"><translation code=\"M\" codeSystem=\"2.16.840.1.113883.5.1\" displayName=\"Male\"/><translation code=\"active\" codeSystem=\"2.16.840.1.113883.5.14\" displayName=\"Active\"/></name>"
                      , xml);
        }
Example #12
0
        private static PhysicalQuantity Half(PhysicalQuantity value_ren)
        {
            BigDecimal quantity = value_ren.Quantity;
            BigDecimal newValue = quantity == null ? null : quantity.Multiply(new BigDecimal("0.5"));

            return(new PhysicalQuantity(newValue, value_ren.Unit));
        }
Example #13
0
 public CurveF(float val, PhysicalQuantity pq, PointF[] data)
 {
     this.name = "";
     this.val  = val;
     this.pq   = pq;
     this.data = data;
 }
Example #14
0
        /// <summary>
        /// Constructs a PeriodicIntervalTimeSk using the supplied parameters.
        /// </summary>
        ///
        /// <param name="repetitions_0">number of repetitions</param>
        /// <param name="quantity_1">the lower boundary of the physical quantity range</param>
        /// <param name="quantity_2">the upper boundary of the physical quantity range</param>
        /// <returns>the constructed PeriodicIntervalTime</returns>
        public static PeriodicIntervalTimeSk CreateFrequencySk(Int32?repetitions_0, PhysicalQuantity quantity_1, PhysicalQuantity quantity_2)
        {
            Interval <PhysicalQuantity> ivlPq = IntervalUtil.CreateInterval(quantity_1, quantity_2);

            return(new PeriodicIntervalTimeSk(null, null, repetitions_0, ivlPq,
                                              Representation.FREQUENCY));
        }
Example #15
0
        public virtual void TestFormatValueNonNull()
        {
            PhysicalQuantity numerator1 = new PhysicalQuantity(BigDecimal.ONE, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                               .CENTIMETRE);
            PhysicalQuantity denominator1 = new PhysicalQuantity(new BigDecimal(2), Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                                 .CUBIC_CENTIMETER);
            PhysicalQuantity numerator2 = new PhysicalQuantity(BigDecimal.TEN, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                               .MILLIMETER);
            PhysicalQuantity denominator2 = new PhysicalQuantity(new BigDecimal(11), Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                                 .CUBIC_MILIMETER);
            Ratio <PhysicalQuantity, PhysicalQuantity> ratio1 = new Ratio <PhysicalQuantity, PhysicalQuantity>(numerator1, denominator1
                                                                                                               );
            Ratio <PhysicalQuantity, PhysicalQuantity> ratio2 = new Ratio <PhysicalQuantity, PhysicalQuantity>(numerator2, denominator2
                                                                                                               );
            SETImpl <RTO <PhysicalQuantity, PhysicalQuantity>, Ratio <PhysicalQuantity, PhysicalQuantity> > set = new SETImpl <RTO <PhysicalQuantity
                                                                                                                                    , PhysicalQuantity>, Ratio <PhysicalQuantity, PhysicalQuantity> >(typeof(RTOImpl <PhysicalQuantity, PhysicalQuantity>));

            set.RawSet().AddAll(MakeSet(ratio1, ratio2));
            string result = new SetPropertyFormatter(this.formatterRegistry).Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                        (new ModelToXmlResult(), null, "blah", "SET<RTO<PQ.DRUG,PQ.TIME>>", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY
                                                                                        , Cardinality.Create("1-4"), false, SpecificationVersion.R02_04_02, null, null, null, false), set);

            AssertXml("non null", "<blah><numerator unit=\"cm\" value=\"1\"/><denominator unit=\"cm3\" value=\"2\"/></blah><blah><numerator unit=\"mm\" value=\"10\"/><denominator unit=\"mm3\" value=\"11\"/></blah>"
                      , result);
        }
Example #16
0
        public void SetOyMax(float max)
        {
            PhysicalQuantity pq     = this.yPlotVariable.Variable.Type;
            double           newMax = UnitSystemService.GetInstance().ConvertToSIValue(pq, (double)max);

            this.psychrometricChartModel.SetOyMax((double)newMax);
            this.UpdateCurrentStateOrProcess();
        }
Example #17
0
        public virtual void TestParseNoCorrectAttributeNodes()
        {
            XmlNode          node             = CreateNode("<something notvalue=\"\" />");
            PhysicalQuantity physicalQuantity = (PhysicalQuantity) new PqR2ElementParser().Parse(CreateContext("PQ", SpecificationVersion
                                                                                                               .V02R02), node, this.xmlResult).BareValue;

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNull(physicalQuantity, "PhysicalQuantity");
        }
Example #18
0
        private IDictionary <string, string> GetAttributes(DateDiff period, FormatContext context)
        {
            PhysicalQuantity quantity   = period.ValueAsPhysicalQuantity;
            FormatContext    newContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("PQ.TIME", context);

            // getAttributeNameValuePairs is never called with a null value; directly calling it from here is a bit of a cheat, so ensure no null passed in
            return(quantity == null ? new Dictionary <string, string>() : new PqPropertyFormatter().GetAttributeNameValuePairs(newContext
                                                                                                                               , quantity));
        }
Example #19
0
        private string CreatePeriod(PeriodicIntervalTimeR2 value, FormatContext context, int indentLevel)
        {
            PhysicalQuantity period        = value.Period;
            FormatContext    periodContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("PQ", PERIOD, context
                                                                                                                       );
            PQ periodWrapper = new PQImpl(period);

            return(this.pqFormatter.Format(periodContext, periodWrapper, indentLevel));
        }
Example #20
0
        public virtual void TestPhysicalQuantityEquals()
        {
            PhysicalQuantity pq1 = new PhysicalQuantity(new BigDecimal(1.5), Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                        .CENTIMETRE);
            PhysicalQuantity pq2 = new PhysicalQuantity(new BigDecimal(1.5), Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                        .CENTIMETRE);

            Assert.AreEqual(pq1, pq2);
        }
Example #21
0
 public PeriodicIntervalTimeR2(Interval <PlatformDate> phase, PhysicalQuantity period, CalendarCycle alignment,
                               Boolean?institutionSpecified, Int32?frequencyRepetitions, PhysicalQuantity frequencyQuantity)
 {
     Phase                = phase;
     Period               = period;
     Alignment            = alignment;
     InstitutionSpecified = institutionSpecified;
     FrequencyRepetitions = frequencyRepetitions;
     FrequencyQuantity    = frequencyQuantity;
 }
Example #22
0
        public static PeriodicIntervalTimeR2 CreateFromPivlR1(PeriodicIntervalTime pivlR1)
        {
            DateDiff                period   = pivlR1.Period;
            PhysicalQuantity        periodPq = (period != null ? period.ValueAsPhysicalQuantity : null);
            Interval <PlatformDate> phase    = pivlR1.Phase;
            PhysicalQuantity        quantity = pivlR1.Quantity;
            Int32?repetitions = pivlR1.Repetitions;

            return(new PeriodicIntervalTimeR2(phase, periodPq, null, null, repetitions, quantity));
        }
Example #23
0
        public virtual void TestFormatPhysicalQuantityValueOrUnitNull()
        {
            // no name-value pairs
            PqPropertyFormatter formatter        = new PqPropertyFormatter();
            PhysicalQuantity    physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Unit = Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.MILLIGRAM;
            formatter.Format(CreateContext(), new PQImpl(physicalQuantity));
            Assert.AreEqual("No value provided for physical quantity", this.result.GetHl7Errors()[0].GetMessage());
        }
Example #24
0
 protected PeriodicIntervalTime(DateDiff period_0, Interval <Ca.Infoway.Messagebuilder.PlatformDate> phase_1,
                                Int32?repetitions_2, PhysicalQuantity quantity_3,
                                Representation representation_4)
 {
     this.period         = period_0;
     this.phase          = phase_1;
     this.repetitions    = repetitions_2;
     this.quantity       = quantity_3;
     this.representation = representation_4;
 }
Example #25
0
        public virtual void TestParseValidAttributesNoUnit()
        {
            XmlNode          node             = CreateNode("<something value=\"1234.45\" />");
            PhysicalQuantity physicalQuantity = (PhysicalQuantity) new PqR2ElementParser().Parse(CreateContext("PQ", SpecificationVersion
                                                                                                               .V02R02), node, this.xmlResult).BareValue;

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNotNull(physicalQuantity, "PhysicalQuantity");
            Assert.AreEqual("1234.45", physicalQuantity.Quantity.ToString(), "value");
            Assert.IsNull(physicalQuantity.Unit, "unit");
        }
Example #26
0
        public virtual void TestParseNoCorrectAttributeNodes()
        {
            XmlNode          node             = CreateNode("<something notvalue=\"\" />");
            PhysicalQuantity physicalQuantity = (PhysicalQuantity) new PqElementParser().Parse(CreateContext("PQ.BASIC", SpecificationVersion
                                                                                                             .V02R02), node, this.xmlResult).BareValue;

            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count);
            Assert.IsNull(physicalQuantity, "PhysicalQuantity");
            Assert.IsFalse(this.xmlResult.IsValid(), "result");
        }
Example #27
0
        public virtual void TestParseValidAttributes()
        {
            XmlNode          node             = CreateNode("<something value=\"1234.45\" unit=\"kg\" />");
            PhysicalQuantity physicalQuantity = (PhysicalQuantity) new PqR2ElementParser().Parse(CreateContext("PQ", SpecificationVersion
                                                                                                               .V02R02), node, this.xmlResult).BareValue;

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNotNull(physicalQuantity, "PhysicalQuantity");
            Assert.AreEqual(new BigDecimal("1234.45"), physicalQuantity.Quantity, "quantity");
            Assert.AreEqual(CeRxDomainTestValues.KILOGRAM.CodeValue, physicalQuantity.Unit.CodeValue, "unit");
        }
Example #28
0
        /// <exception cref="System.Exception"></exception>
        private void AssertFormattingAsExpected(string quantity, string formattedQuantity)
        {
            PhysicalQuantity physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Quantity = new BigDecimal(quantity);
            physicalQuantity.Unit     = CeRxDomainTestValues.CENTIMETRE;
            IDictionary <string, string> result = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (CreateContext("PQ"), physicalQuantity, null);

            Assert.AreEqual(formattedQuantity, result.SafeGet("value"), "value " + quantity);
        }
Example #29
0
        /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
        protected override PeriodicIntervalTimeR2 ParseNonNullNode(ParseContext context, XmlNode node, BareANY result, Type expectedReturnType
                                                                   , XmlToModelResult xmlToModelResult)
        {
            XmlElement              periodElement = (XmlElement)GetNamedChildNode(node, "period");
            PhysicalQuantity        period        = CreatePeriodType(context, periodElement, xmlToModelResult);
            XmlElement              phaseElement  = (XmlElement)GetNamedChildNode(node, "phase");
            Interval <PlatformDate> phase         = CreatePhaseType(context, phaseElement, xmlToModelResult);
            CalendarCycle           alignment     = ObtainAlignment(context, (XmlElement)node, xmlToModelResult);
            bool institutionSpecified             = ObtainInstitutionSpecified(context, (XmlElement)node, xmlToModelResult);

            return(new PeriodicIntervalTimeR2(phase, period, alignment, institutionSpecified, null, null));
        }
Example #30
0
        public virtual void TestFormatPhysicalQuantityValueOrUnitNull()
        {
            // no name-value pairs
            PqR2PropertyFormatter formatter        = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter();
            PhysicalQuantity      physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Unit = CeRxDomainTestValues.ENZYME_UNIT_MICROMOLES_MINUTE_PER_LITRE;
            string result = formatter.Format(CreateContext("PQ"), new PQImpl(physicalQuantity));

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual("<name unit=\"U/L\"/>", result.Trim(), "map size");
        }