Beispiel #1
0
 internal Timestamps( IValueIter parent, Timestamps timestamps )
 {
     // Reference on same data of an existing Timestamps.
     mParent = parent;
     mTimestamps = timestamps.mTimestamps;
     mStartDateTime = timestamps.mStartDateTime;
     mLength = timestamps.Length;
     mTotalLength = mLength;
 }
Beispiel #2
0
 internal bool IsSyncWith(Timestamps timeStamps)
 {
     // TODO Check for sync. For now assume all input
     // are synchronized.
     return(true);
 }
Beispiel #3
0
 internal bool IsSyncWith(Timestamps timeStamps)
 {
     // TODO Check for sync. For now assume all input
     // are synchronized.
     return true;
 }
Beispiel #4
0
        internal Index(params IValueIter[] list)
        {
            // Handle special case of empty list.
            if (list.Length == 0)
            {
                mLeftToIterate = 0;
                return;
            }


            // Each ValueIter have a corresponding "offset" maintained
            // locally in the Index object.
            mStartOffset = new int[list.Length];

            // Validate all synchronized.
            // At the same time, identify the common range.
            int        begCommonRange;
            int        endCommonRange;
            IValueIter valueIter = list[0];

            endCommonRange  = valueIter.GetEndTimestampOffset();
            begCommonRange  = valueIter.GetStartTimestampOffset();
            mStartOffset[0] = begCommonRange;
            if (list.Length > 1)
            {
                Timestamps refTimestamps = valueIter.GetTimestamps();
                for (int i = 1; i < list.Length; i++)
                {
                    valueIter = list[i];
                    if (!valueIter.GetTimestamps().Equals(refTimestamps))
                    {
                        throw new Exception("Iteration possible only for synchronized Timeseries and Variable");
                    }
                    int temp = valueIter.GetStartTimestampOffset();
                    if (temp > begCommonRange)
                    {
                        begCommonRange = temp;
                    }
                    mStartOffset[i] = temp;
                    temp            = valueIter.GetEndTimestampOffset();
                    if (temp < endCommonRange)
                    {
                        endCommonRange = temp;
                    }
                }
            }

            // The number of elements left to be iterated.
            mLeftToIterate = endCommonRange - begCommonRange + 1;

            // Handle case of an empty ValueIter or no common range.
            if (mLeftToIterate <= 0)
            {
                mLeftToIterate = 0;
                return;
            }

            // Now that the common range is known, adjust the starting
            // offset for each ValueIter.
            for (int i = 0; i < list.Length; i++)
            {
                mStartOffset[i] = begCommonRange - mStartOffset[i];
            }

            // Calculate the starting offset for the timestamp array.
            mTimestampOffset = begCommonRange;

            // Keep a reference on the list of ValueIter
            mValueIter = list;
        }