-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCustomSorts.cs
More file actions
153 lines (123 loc) · 3.92 KB
/
Copy pathCustomSorts.cs
File metadata and controls
153 lines (123 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Copyright 2009, 2010, 2011 Kevin Schott
// This file is part of SecondSight.
// SecondSight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// SecondSight is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with SecondSight. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Data;
namespace SecondSight
{
/// <summary>
/// Comparer class for sorting report results when Group By is a Sphere or Add field
/// </summary>
public sealed class RxSortComparer : IComparer<KeyValuePair<object, DataRow>>
{
public int Compare(KeyValuePair<object, DataRow> a, KeyValuePair<object, DataRow> b)
{
if (a.Equals(b))
return 0;
float af = (float)a.Key;
float bf = (float)b.Key;
return af.CompareTo(bf);
}
};
/// <summary>
/// Comparer class for sorting report results when Group By is a Cylinder field
/// </summary>
public sealed class CylinderSortComparer : IComparer<KeyValuePair<object, DataRow>>
{
public int Compare(KeyValuePair<object, DataRow> a, KeyValuePair<object, DataRow> b)
{
if (a.Equals(b))
return 0;
float af = (float)a.Key;
float bf = (float)b.Key;
return bf.CompareTo(af);
}
};
/// <summary>
/// Comparer class for sorting report results when Group By is an Axis field.
/// </summary>
public sealed class AxisSortComparer : IComparer<KeyValuePair<object, DataRow>>
{
public int Compare(KeyValuePair<object, DataRow> a, KeyValuePair<object, DataRow> b)
{
if (a.Equals(b))
return 0;
char ac = (char)a.Key;
char bc = (char)b.Key;
if (ac == 'W' || bc == 'O')
return -1;
else if (ac == 'O' || bc == 'W')
return 1;
return 0;
}
};
public sealed class TypeSortComparer : IComparer<KeyValuePair<object, DataRow>>
{
public int Compare(KeyValuePair<object, DataRow> a, KeyValuePair<object, DataRow> b)
{
if (a.Equals(b))
return 0;
char ac = (char)a.Key;
char bc = (char)b.Key;
if (ac == 'S' || bc == 'M')
return -1;
return 1;
}
}
public sealed class GenderSortComparer : IComparer<KeyValuePair<object, DataRow>>
{
public int Compare(KeyValuePair<object, DataRow> a, KeyValuePair<object, DataRow> b)
{
if (a.Equals(b))
return 0;
char ac = (char)a.Key;
char bc = (char)b.Key;
if (ac == 'U' || bc == 'F')
return -1;
else if (ac == 'F' || bc == 'U')
return 1;
return 0;
}
}
public sealed class SizeSortComparer : IComparer<KeyValuePair<object, DataRow>>
{
public int Compare(KeyValuePair<object, DataRow> a, KeyValuePair<object, DataRow> b)
{
if (a.Equals(b))
return 0;
char ac = (char)a.Key;
char bc = (char)b.Key;
if (ac == 'S' || bc == 'L')
return -1;
else if (ac == 'L' || bc == 'S')
return 1;
return 0;
}
}
public sealed class TintSortComparer : IComparer<KeyValuePair<object, DataRow>>
{
public int Compare(KeyValuePair<object, DataRow> a, KeyValuePair<object, DataRow> b)
{
if (a.Equals(b))
return 0;
char ac = (char)a.Key;
char bc = (char)b.Key;
if (ac == 'N' || bc == 'D')
return -1;
else if (ac == 'D' || bc == 'N')
return 1;
return 0;
}
}
} //namespace SecondSight