Esempio n. 1
0
        private bool AppendFilter(IConsoleViewFilter filter)
        {
            ConsoleViewCellEntry[] entriesArray = Entries.InternalArray;
            int toIndex = m_filteredIndices.HeadIndex;

            for (int fromIndex = toIndex; fromIndex < m_filteredIndices.Length; ++fromIndex)
            {
                int entryIndex      = m_filteredIndices[fromIndex];
                int entryArrayIndex = Entries.ToArrayIndex(entryIndex);
                if (filter.Apply(ref entriesArray[entryArrayIndex]))
                {
                    m_filteredIndices[toIndex] = entryIndex;
                    ++toIndex;
                }
            }

            // TODO: check filtered indices values (indices count can remain the same but lines can change)
            m_oldConsoleEntriesHeadIndex = Entries.HeadIndex;

            if (toIndex != m_filteredIndices.Length)
            {
                m_filteredIndices.TrimToLength(toIndex);
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        private bool ApplyFilter(IConsoleViewFilter filter)
        {
            int oldIndicesCount = m_filteredIndices.RealLength;

            ClearIndices();

            ConsoleViewCellEntry[] entriesArray = Entries.InternalArray;
            for (int entryIndex = Entries.HeadIndex; entryIndex < Entries.Length; ++entryIndex)
            {
                int entryArrayIndex = Entries.ToArrayIndex(entryIndex);
                if (filter.Apply(ref entriesArray[entryArrayIndex]))
                {
                    m_filteredIndices.Add(entryIndex);
                }
            }

            // TODO: check filtered indices values (indices count can remain the same but lines can change)
            m_oldConsoleEntriesHeadIndex = Entries.HeadIndex;

            return(m_filteredIndices.RealLength != oldIndicesCount ||
                   m_filteredIndices.RealLength != Entries.RealLength);
        }
        private bool AppendFilter(IConsoleViewFilter filter)
        {
            ConsoleViewCellEntry[] entriesArray = Entries.InternalArray;
            int toIndex = m_filteredIndices.HeadIndex;
            for (int fromIndex = toIndex; fromIndex < m_filteredIndices.Length; ++fromIndex)
            {
                int entryIndex = m_filteredIndices[fromIndex];
                int entryArrayIndex = Entries.ToArrayIndex(entryIndex);
                if (filter.Apply(ref entriesArray[entryArrayIndex]))
                {
                    m_filteredIndices[toIndex] = entryIndex;
                    ++toIndex;
                }
            }

            // TODO: check filtered indices values (indices count can remain the same but lines can change)
            m_oldConsoleEntriesHeadIndex = Entries.HeadIndex;

            if (toIndex != m_filteredIndices.Length)
            {
                m_filteredIndices.TrimToLength(toIndex);
                return true;
            }

            return false;
        }
        private bool ApplyFilter(IConsoleViewFilter filter)
        {
            int oldIndicesCount = m_filteredIndices.RealLength;
            ClearIndices();

            ConsoleViewCellEntry[] entriesArray = Entries.InternalArray;
            for (int entryIndex = Entries.HeadIndex; entryIndex < Entries.Length; ++entryIndex)
            {
                int entryArrayIndex = Entries.ToArrayIndex(entryIndex);
                if (filter.Apply(ref entriesArray[entryArrayIndex]))
                {
                    m_filteredIndices.Add(entryIndex);
                }
            }

            // TODO: check filtered indices values (indices count can remain the same but lines can change)
            m_oldConsoleEntriesHeadIndex = Entries.HeadIndex;

            return m_filteredIndices.RealLength != oldIndicesCount ||
                m_filteredIndices.RealLength != Entries.RealLength;
        }