Example #1
0
        /// <summary>
        ///     Gets the previous before minimum.
        /// </summary>
        /// <returns>The previous before minimum.</returns>
        /// <param name="minimum">Minimum.</param>
        protected ArrayIndexInfo GetPreviousBeforeMinimum(ArrayIndexInfo minimum)
        {
            ArrayIndexInfo previous = new ArrayIndexInfo();

            if (minimum.Index > 0)
            {
                previous.Index = minimum.Index - 1;
                previous.Value = m_circularListArr[previous.Index];
            }
            else
            {
                previous.Index = m_circularListArr.Length - 1;
                previous.Value = m_circularListArr[previous.Index];
            }
            return(previous);
        }
Example #2
0
        /// <summary>
        ///     Gets the minimum index of the value with.
        /// </summary>
        /// <returns>The minimum value with index.</returns>
        protected ArrayIndexInfo GetMinimumValueWithIndex()
        {
            ArrayIndexInfo indexInfo = new ArrayIndexInfo();

            indexInfo.Index = -1;
            indexInfo.Value = m_circularListArr[0];

            for (int i = 0; i < m_circularListArr.Length; i++)
            {
                int value = m_circularListArr[i];
                if (value < indexInfo.Value)
                {
                    indexInfo.Index = i;
                    indexInfo.Value = value;
                }
            }
            return(indexInfo);
        }
Example #3
0
 /// <summary>
 ///     Gets the element before the minimum element.
 /// </summary>
 /// <returns>The previous.</returns>
 /// <param name="minimum">Minimum.</param>
 public ArrayIndexInfo GetPrevious(ArrayIndexInfo minimum)
 {
     return(GetPreviousBeforeMinimum(minimum));
 }