< Summary

Class:GDX.DataTables.ColumnSorters.BoolColumnSorter
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/DataTables/ColumnSorters/BoolColumnSorter.cs
Covered lines:0
Uncovered lines:14
Coverable lines:14
Total lines:37
Line coverage:0% (0 of 14)
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
BoolColumnSorter(...)0%2100%
Compare(...)0%20400%

File(s)

./Packages/com.dotbunny.gdx/GDX/DataTables/ColumnSorters/BoolColumnSorter.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    class BoolColumnSorter : ColumnSorterBase, IComparer<RowDescription>
 10    {
 11        /// <inheritdoc />
 12        public BoolColumnSorter(DataTableBase dataTable, int rowCount, int columnIdentifier, int sortDirection,
 13            bool supportMultiSort = false) :
 014            base(dataTable, rowCount, columnIdentifier, sortDirection, supportMultiSort)
 015        {
 016        }
 17
 18        /// <inheritdoc />
 19        public int Compare(RowDescription x, RowDescription y)
 020        {
 021            bool lhs = DataTable.GetBool(x.Identifier, ColumnIdentifier);
 022            bool rhs = DataTable.GetBool(y.Identifier, ColumnIdentifier);
 23
 024            if (lhs && !rhs)
 025            {
 026                return ProcessCompare(-1);
 27            }
 28
 029            if (!lhs && rhs)
 030            {
 031                return ProcessCompare(1);
 32            }
 33
 034            return ProcessCompare(0, x.Identifier, y.Identifier);
 035        }
 36    }
 37}