示例#1
0
    //----------------------------------------------------------------------------

    /*!
     *          @brief	配列の内包チェック
     */
    //----------------------------------------------------------------------------
    public bool ChkInside(System.Comparison <T> fnComparer, T tTarget)
    {
        for (int i = 0; i < m_BufferSize; ++i)
        {
            if (fnComparer.Invoke(m_Buffer[i], tTarget) <= 0)
            {
                continue;
            }

            return(true);
        }

        return(false);
    }
示例#2
0
    /// <summary>
    /// Warning: bubble sort
    /// </summary>
    public void Sort(System.Comparison <T> comparer)
    {
        bool changed = true;

        while (changed)
        {
            changed = false;

            for (int i = 1; i < size; ++i)
            {
                if (comparer.Invoke(buffer[i - 1], buffer[i]) > 0)
                {
                    T temp = buffer[i];
                    buffer[i]     = buffer[i - 1];
                    buffer[i - 1] = temp;
                    changed       = true;
                }
            }
        }
    }
示例#3
0
        public void Sort(System.Comparison <T> comparer)
        {
            bool changed = true;

            while (changed)
            {
                changed = false;

                for (int i = 1; i < _len; i++)
                {
                    if (comparer.Invoke(_buffer[i - 1], _buffer[i]) > 0)
                    {
                        T temp = _buffer[i];
                        _buffer[i]     = _buffer[i - 1];
                        _buffer[i - 1] = temp;
                        changed        = true;
                    }
                }
            }
        }