< Summary

Class:GDX.DataTables.ColumnSorters.ColumnSorterBase
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/DataTables/ColumnSorters/ColumSorterBase.cs
Covered lines:0
Uncovered lines:22
Coverable lines:22
Total lines:51
Line coverage:0% (0 of 22)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:2
Method coverage:0% (0 of 2)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ColumnSorterBase(...)0%12300%
ProcessCompare(...)0%20400%

File(s)

./Packages/com.dotbunny.gdx/GDX/DataTables/ColumnSorters/ColumSorterBase.cs

#LineLine coverage
 1// Copyright (c) 2020-2024 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5using System.Collections.Generic;
 6
 7namespace GDX.DataTables.ColumnSorters
 8{
 9    abstract class ColumnSorterBase
 10    {
 11        protected readonly int ColumnIdentifier;
 12        protected readonly DataTableBase DataTable;
 13        public readonly List<int> EqualIdentifiers;
 14        readonly int m_SortDirection;
 15        readonly bool m_SupportMultiSort;
 16
 017        protected ColumnSorterBase(DataTableBase dataTable, int rowCount, int columnIdentifier, int sortDirection,
 18            bool supportMultiSort = false)
 019        {
 020            DataTable = dataTable;
 021            ColumnIdentifier = columnIdentifier;
 022            m_SortDirection = sortDirection;
 023            m_SupportMultiSort = supportMultiSort;
 024            EqualIdentifiers = m_SupportMultiSort ? new List<int>(rowCount) : null;
 025        }
 26
 27        protected int ProcessCompare(int compare, int lhsIdentifier = -1, int rhsIdentifier = -1)
 028        {
 029            if (compare == 0)
 030            {
 31                // Same
 032                if (!m_SupportMultiSort)
 033                {
 034                    return 0;
 35                }
 36
 037                EqualIdentifiers.Add(lhsIdentifier);
 038                EqualIdentifiers.Add(rhsIdentifier);
 39
 040                return 0;
 41            }
 42
 043            if (m_SortDirection == 0)
 044            {
 045                return compare * -1;
 46            }
 47
 048            return compare;
 049        }
 50    }
 51}