Source/NFX/DataAccess/CRUD/Table.cs
/// <summary>
/// Performs binary search on a sorted table
/// </summary>
Performs binary search on a sorted table
Performs binary search on a sorted table
protected override int SearchForRow(Row row, out int index)
            {
                int top = 0;
                int bottom = m_List.Count - 1;
                index = 0;
                while (top <= bottom)
                {
                    index = top + ((bottom - top) / 2);
                    int cmpResult  = Compare(row, m_List[index]);
                    if (cmpResult == 0)
                    {
                      return index;
                    }
                    if (cmpResult > 0)
                    {
                      top = index + 1;
                      index = top;
                    }
                    else
                    {
                      bottom = index - 1;
                    }
                }
                return -1;
            }
protected override int SearchForRow ( Row row , out int index ) { int top = 0 ; int bottom = m_List . Count - 1 ; index = 0 ; while ( top <= bottom ) { index = top + ( ( bottom - top ) / 2 ) ; int cmpResult = Compare ( row , m_List [ index ] ) ; if ( cmpResult == 0 ) { return index ; } if ( cmpResult > 0 ) { top = index + 1 ; index = top ; } else { bottom = index - 1 ; } } return - 1 ; }
Performs binary search on a sorted table
Performs binary search on a sorted table
row
Row
int
out