This class stores a date/value pair. A timeseries can then be composed from an array of such objects. The class is designed for use by .NET. COM callers will instead use the equivalent TSDateValueStruct struct.
예제 #1
0
        /// <summary>
        /// This method checks whether the values of all properties of the given object are the
        /// same as the properties of this object.  The given object may be of any type, so the
        /// method checks whether it is of type TimeSeriesValue (if not, it returns false).
        /// </summary>
        /// <param name="obj">the object to compare to this object</param>
        /// <returns>true if the given object has the same property values as this object,
        /// otherwise false.</returns>
        public Boolean ValueEquals(Object obj)
        {
            // If we have the very same instance of the object, then no need to go further
            if (this == obj)
            {
                return(true);
            }
            // if obj is null
            if (obj == null)
            {
                return(false);
            }
            // if obj is not of matching type
            if ((obj is TimeSeriesValue) == false)
            {
                return(false);
            }
            // recast so that we can access the properties that we'll need to compare
            TimeSeriesValue obj2 = (TimeSeriesValue)obj;

            // Compare individual properties
            if (this.Date != obj2.Date)
            {
                return(false);
            }
            if (this.Value != obj2.Value)
            {
                return(false);
            }

            return(true);
        }
        public void ConvertToStruct2()
        {
            TSDateValueStruct tsdvs = new TSDateValueStruct { Date = date2, Value = val2 };
            TimeSeriesValue tsv = new TimeSeriesValue { Date = date2, Value = val2 };

            TSDateValueStruct actual = ((TSDateValueStruct)(tsv));
            Assert.AreEqual(tsdvs, actual);
        }
        public void ConvertFromStruct2()
        {
            TSDateValueStruct tsdvs = new TSDateValueStruct { Date = date2, Value = val2 };
            TimeSeriesValue tsv = new TimeSeriesValue { Date = date2, Value = val2 };

            TimeSeriesValue actual = ((TimeSeriesValue)(tsdvs));
            Assert.IsTrue(tsv.ValueEquals(actual));
        }
        public void ValueEqualsTrueTest()
        {
            TimeSeriesValue tsv1 = new TimeSeriesValue { Date = date1, Value = val1 };
            TimeSeriesValue tsv2 = new TimeSeriesValue { Date = date1, Value = val1 };

            Assert.IsTrue(tsv1.ValueEquals(tsv2));
        }