ComputeChecksum() public method

This method computes a Checksum for the timeseries. The input to the hash includes the list of parameters of the time series, and the list of checksums for each of the traces in the time series ensemble. The list of the traces' checksums are passed to this method within a list of ITimeSeriesTrace objects. This method does not modify the object given in the traceList parameter or assign any property values to any of its items.
public ComputeChecksum ( TSDateCalculator timeStepUnit, short timeStepQuantity, System.DateTime blobStartDate, List traceList ) : byte[]
timeStepUnit TSDateCalculator TSDateCalculator.TimeStepUnitCode value for Minute,Hour,Day,Week,Month, Year, or Irregular
timeStepQuantity short The number of the given unit that defines the time step. /// For instance, if the time step is 6 hours long, then this value is 6.
blobStartDate System.DateTime Date of the first time step in the BLOB
traceList List a list of trace object whose checksums have already been computed.
return byte[]
コード例 #1
0
        // This method is reused by the actual test methods that follow
        public Boolean ComputeTestChecksums(
                TSDateCalculator.TimeStepUnitCode u1, short q1,
                    DateTime sDate1, List<ITimeSeriesTrace> traceList1,
                TSDateCalculator.TimeStepUnitCode u2, short q2,
                    DateTime sDate2, List<ITimeSeriesTrace> traceList2)
        {
            TSLibrary tsLib = new TSLibrary();

            byte[] b1 = tsLib.ComputeChecksum(u1, q1, sDate1, traceList1);
            byte[] b2 = tsLib.ComputeChecksum(u2, q2, sDate2, traceList2);

            Assert.IsTrue(b1.Length == 16);
            Assert.IsTrue(b2.Length == 16);

            for (int i = 0; i < b2.Length; i++)
                if (b1[i] != b2[i])
                    return false;

            return true;
        }
コード例 #2
0
        public void ComputeChecksum_Err1()
        {
            TSLibrary tsLib = new TSLibrary();
            TSTrace traceObject = new TSTrace { TraceNumber = 1 };

            try
            {
                byte[] blobData = tsLib.ComputeChecksum(
                        TSDateCalculator.TimeStepUnitCode.Irregular, 3,
                        IrregList1.First().Date, new List<ITimeSeriesTrace>());
                Assert.Fail("Should have thrown exception");
            }
            catch (TSLibraryException e)
            {
                Assert.AreEqual(ErrCode.Enum.Checksum_Quantity_Nonzero, e.ErrCode);
            }
        }