001package org.unix4j.unix.sort;
002
003import org.unix4j.unix.Sort;
004
005/**
006 * Options for the {@link Sort sort} command with the 
007 * the following options: 
008 * <p>
009 * <table>
010 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -c}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --check}</td><td>&nbsp;</td><td>Checks that the single input file is ordered as specified by the
011                        arguments and the collating sequence of the current locale. No 
012                        output is produced; only the exit code is affected.</td></tr>
013 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -m}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --merge}</td><td>&nbsp;</td><td>Merge only; the input file are assumed to be already sorted.</td></tr>
014 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -u}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --unique}</td><td>&nbsp;</td><td>Unique: suppress all but one in each set of lines having equal keys.
015                        If used with the {@code -c} option, checks that there are no lines 
016                        with duplicate keys, in addition to checking that the input file is 
017                        sorted.</td></tr>
018 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -b}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --ignoreLeadingBlanks}</td><td>&nbsp;</td><td>Ignore leading blanks. 
019                        (This option is ignored if a comparator operand is present).</td></tr>
020 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -d}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --dictionaryOrder}</td><td>&nbsp;</td><td>Consider only blanks and alphanumeric characters.
021                        (This option is ignored if a comparator operand is present).</td></tr>
022 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -f}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --ignoreCase}</td><td>&nbsp;</td><td>Consider all lowercase characters that have uppercase equivalents to
023                        be the uppercase equivalent for the purposes of comparison.
024                        (This option is ignored if a comparator operand is present).</td></tr>
025 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -n}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --numericSort}</td><td>&nbsp;</td><td>Sort numerically; the number begins each line and consists of 
026                        optional blanks, an optional minus sign, and zero or more digits
027                        possibly separated by thousands separators, optionally followed by a
028                        decimal-point character and zero or more digits. An empty number is
029                        treated as '0'. The current local specifies the decimal-point 
030                        character and thousands separator.
031                        <p>
032                        Comparison is exact; there is no rounding error.
033                        <p>
034                        Neither a leading '+' nor exponential notation is recognized. To 
035                        compare such strings numerically, use the
036                        {@code -genericNumericSort (-g)} option. 
037<p>
038                        (This option is ignored if a comparator operand is present).</td></tr>
039 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -g}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --generalNumericSort}</td><td>&nbsp;</td><td>Sort numerically, using the standard {@link Double#parseDouble(String)}  
040                        function to convert a trimmed line to a double-precision floating 
041                        point number. This allows floating point numbers to be specified in 
042                        scientific notation, like 1.0e-34 and 10e100. 
043                        <p>
044                        Uses the following collating sequence: Lines that cannot be parsed 
045                        because they do not represent valid double values (in alpha-numeric
046                        order); "-Infinity"; finite numbers in ascending numeric order 
047                        (with -0 < +0); "Infinity"; "NaN".
048<p>
049                        This option is usually slower than {@code -numeric-sort (-n)} and it
050                        can lose information when converting to floating point.         
051                <p>
052                        (This option is ignored if a comparator operand is present).</td></tr>
053 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -h}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --humanNumericSort}</td><td>&nbsp;</td><td>Sort numerically, first by numeric sign (negative, zero, or 
054                        positive); then by SI suffix (either empty, or 'k' or 'K', or one 
055                        of 'MGTPEZY', in that order); and finally by numeric value. For
056                        example, '1023M' sorts before '1G' because 'M' (mega) precedes 'G' 
057                        (giga) as an SI suffix. 
058                        <p>
059                        This option sorts values that are consistently scaled to the nearest
060                        suffix, regardless of whether suffixes denote powers of 1000 or
061                        1024, and it therefore sorts the output of any single invocation of 
062                        the {@code ls} command that are invoked with the --human-readable 
063                        option. 
064                        <p>
065                        The syntax for numbers is the same as for the
066                        {@code --numericSort (-n)} option; the SI suffix must immediately 
067                        follow the number.              
068<p>
069                        (This option is ignored if a comparator operand is present).</td></tr>
070 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -M}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --monthSort}</td><td>&nbsp;</td><td>An initial string, consisting of any amount of blanks, followed by a
071                        month name abbreviation, is folded to UPPER case and compared in the
072                        order: (unknown) < 'JAN' < ... < 'DEC'. The current locale
073                        determines the month spellings.</td></tr>
074 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -V}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --versionSort}</td><td>&nbsp;</td><td>Sort by version name and number. It behaves like a standard sort, 
075                        except that each sequence of decimal digits is treated numerically 
076                        as an index/version number.
077                        <p>
078                        (This option is ignored if a comparator operand is present).</td></tr>
079 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -r}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --reverse}</td><td>&nbsp;</td><td>Reverse the sense of comparisons.</td></tr>
080 * </table>
081 * <p>
082 * This class serves as entry point to every possible set of {@code sort} options
083 * defined as an enum constant. With this explicit expansion of all possible 
084 * option combinations, options can be passed to the command in a very compact 
085 * form, such as:
086 * <pre>
087 * sort(Sort.Options.c, ...);
088 * sort(Sort.Options.c.m, ...);
089 * ...
090 * sort(Sort.Options.c.m.u.b.d.f.n.g.h.M.V.r, ...);
091 * </pre>
092 */
093public final class SortOptionSets {
094        /**
095         * The singleton instance.
096         */
097        public static final SortOptionSets INSTANCE = new SortOptionSets();
098        
099        /**
100         * Option {@code "-c"}: Checks that the single input file is ordered as specified by the
101                        arguments and the collating sequence of the current locale. No 
102                        output is produced; only the exit code is affected.
103         * <p>
104         * The option {@code "-c"} is equivalent to the {@code "--}{@link #check check}{@code "} option.
105         */
106        public final SortOptionSet_MVbcdfghnru c = SortOptionSet_MVbcdfghnru.Active_c;  
107        /**
108         * Option {@code "--check"}: Checks that the single input file is ordered as specified by the
109                        arguments and the collating sequence of the current locale. No 
110                        output is produced; only the exit code is affected.
111         * <p>
112         * The option {@code "--check"} is equivalent to the {@code "-}{@link #c c}{@code "} option.
113         */
114        public final SortOptionSet_MVbcdfghnru check = SortOptionSet_MVbcdfghnru.Active_c_long;  
115        /**
116         * Option {@code "-d"}: Consider only blanks and alphanumeric characters.
117                        (This option is ignored if a comparator operand is present).
118         * <p>
119         * The option {@code "-d"} is equivalent to the {@code "--}{@link #dictionaryOrder dictionaryOrder}{@code "} option.
120         */
121        public final SortOptionSet_MVbcdfghmnru d = SortOptionSet_MVbcdfghmnru.Active_d;  
122        /**
123         * Option {@code "--dictionaryOrder"}: Consider only blanks and alphanumeric characters.
124                        (This option is ignored if a comparator operand is present).
125         * <p>
126         * The option {@code "--dictionaryOrder"} is equivalent to the {@code "-}{@link #d d}{@code "} option.
127         */
128        public final SortOptionSet_MVbcdfghmnru dictionaryOrder = SortOptionSet_MVbcdfghmnru.Active_d_long;  
129        /**
130         * Option {@code "-g"}: Sort numerically, using the standard {@link Double#parseDouble(String)}  
131                        function to convert a trimmed line to a double-precision floating 
132                        point number. This allows floating point numbers to be specified in 
133                        scientific notation, like 1.0e-34 and 10e100. 
134                        <p>
135                        Uses the following collating sequence: Lines that cannot be parsed 
136                        because they do not represent valid double values (in alpha-numeric
137                        order); "-Infinity"; finite numbers in ascending numeric order 
138                        (with -0 < +0); "Infinity"; "NaN".
139<p>
140                        This option is usually slower than {@code -numeric-sort (-n)} and it
141                        can lose information when converting to floating point.         
142                <p>
143                        (This option is ignored if a comparator operand is present).
144         * <p>
145         * The option {@code "-g"} is equivalent to the {@code "--}{@link #generalNumericSort generalNumericSort}{@code "} option.
146         */
147        public final SortOptionSet_bcdfgmru g = SortOptionSet_bcdfgmru.Active_g;  
148        /**
149         * Option {@code "--generalNumericSort"}: Sort numerically, using the standard {@link Double#parseDouble(String)}  
150                        function to convert a trimmed line to a double-precision floating 
151                        point number. This allows floating point numbers to be specified in 
152                        scientific notation, like 1.0e-34 and 10e100. 
153                        <p>
154                        Uses the following collating sequence: Lines that cannot be parsed 
155                        because they do not represent valid double values (in alpha-numeric
156                        order); "-Infinity"; finite numbers in ascending numeric order 
157                        (with -0 < +0); "Infinity"; "NaN".
158<p>
159                        This option is usually slower than {@code -numeric-sort (-n)} and it
160                        can lose information when converting to floating point.         
161                <p>
162                        (This option is ignored if a comparator operand is present).
163         * <p>
164         * The option {@code "--generalNumericSort"} is equivalent to the {@code "-}{@link #g g}{@code "} option.
165         */
166        public final SortOptionSet_bcdfgmru generalNumericSort = SortOptionSet_bcdfgmru.Active_g_long;  
167        /**
168         * Option {@code "-h"}: Sort numerically, first by numeric sign (negative, zero, or 
169                        positive); then by SI suffix (either empty, or 'k' or 'K', or one 
170                        of 'MGTPEZY', in that order); and finally by numeric value. For
171                        example, '1023M' sorts before '1G' because 'M' (mega) precedes 'G' 
172                        (giga) as an SI suffix. 
173                        <p>
174                        This option sorts values that are consistently scaled to the nearest
175                        suffix, regardless of whether suffixes denote powers of 1000 or
176                        1024, and it therefore sorts the output of any single invocation of 
177                        the {@code ls} command that are invoked with the --human-readable 
178                        option. 
179                        <p>
180                        The syntax for numbers is the same as for the
181                        {@code --numericSort (-n)} option; the SI suffix must immediately 
182                        follow the number.              
183<p>
184                        (This option is ignored if a comparator operand is present).
185         * <p>
186         * The option {@code "-h"} is equivalent to the {@code "--}{@link #humanNumericSort humanNumericSort}{@code "} option.
187         */
188        public final SortOptionSet_bcdfhmru h = SortOptionSet_bcdfhmru.Active_h;  
189        /**
190         * Option {@code "--humanNumericSort"}: Sort numerically, first by numeric sign (negative, zero, or 
191                        positive); then by SI suffix (either empty, or 'k' or 'K', or one 
192                        of 'MGTPEZY', in that order); and finally by numeric value. For
193                        example, '1023M' sorts before '1G' because 'M' (mega) precedes 'G' 
194                        (giga) as an SI suffix. 
195                        <p>
196                        This option sorts values that are consistently scaled to the nearest
197                        suffix, regardless of whether suffixes denote powers of 1000 or
198                        1024, and it therefore sorts the output of any single invocation of 
199                        the {@code ls} command that are invoked with the --human-readable 
200                        option. 
201                        <p>
202                        The syntax for numbers is the same as for the
203                        {@code --numericSort (-n)} option; the SI suffix must immediately 
204                        follow the number.              
205<p>
206                        (This option is ignored if a comparator operand is present).
207         * <p>
208         * The option {@code "--humanNumericSort"} is equivalent to the {@code "-}{@link #h h}{@code "} option.
209         */
210        public final SortOptionSet_bcdfhmru humanNumericSort = SortOptionSet_bcdfhmru.Active_h_long;  
211        /**
212         * Option {@code "-f"}: Consider all lowercase characters that have uppercase equivalents to
213                        be the uppercase equivalent for the purposes of comparison.
214                        (This option is ignored if a comparator operand is present).
215         * <p>
216         * The option {@code "-f"} is equivalent to the {@code "--}{@link #ignoreCase ignoreCase}{@code "} option.
217         */
218        public final SortOptionSet_MVbcdfghmnru f = SortOptionSet_MVbcdfghmnru.Active_f;  
219        /**
220         * Option {@code "--ignoreCase"}: Consider all lowercase characters that have uppercase equivalents to
221                        be the uppercase equivalent for the purposes of comparison.
222                        (This option is ignored if a comparator operand is present).
223         * <p>
224         * The option {@code "--ignoreCase"} is equivalent to the {@code "-}{@link #f f}{@code "} option.
225         */
226        public final SortOptionSet_MVbcdfghmnru ignoreCase = SortOptionSet_MVbcdfghmnru.Active_f_long;  
227        /**
228         * Option {@code "-b"}: Ignore leading blanks. 
229                        (This option is ignored if a comparator operand is present).
230         * <p>
231         * The option {@code "-b"} is equivalent to the {@code "--}{@link #ignoreLeadingBlanks ignoreLeadingBlanks}{@code "} option.
232         */
233        public final SortOptionSet_MVbcdfghmnru b = SortOptionSet_MVbcdfghmnru.Active_b;  
234        /**
235         * Option {@code "--ignoreLeadingBlanks"}: Ignore leading blanks. 
236                        (This option is ignored if a comparator operand is present).
237         * <p>
238         * The option {@code "--ignoreLeadingBlanks"} is equivalent to the {@code "-}{@link #b b}{@code "} option.
239         */
240        public final SortOptionSet_MVbcdfghmnru ignoreLeadingBlanks = SortOptionSet_MVbcdfghmnru.Active_b_long;  
241        /**
242         * Option {@code "-m"}: Merge only; the input file are assumed to be already sorted.
243         * <p>
244         * The option {@code "-m"} is equivalent to the {@code "--}{@link #merge merge}{@code "} option.
245         */
246        public final SortOptionSet_MVbdfghmnru m = SortOptionSet_MVbdfghmnru.Active_m;  
247        /**
248         * Option {@code "--merge"}: Merge only; the input file are assumed to be already sorted.
249         * <p>
250         * The option {@code "--merge"} is equivalent to the {@code "-}{@link #m m}{@code "} option.
251         */
252        public final SortOptionSet_MVbdfghmnru merge = SortOptionSet_MVbdfghmnru.Active_m_long;  
253        /**
254         * Option {@code "-M"}: An initial string, consisting of any amount of blanks, followed by a
255                        month name abbreviation, is folded to UPPER case and compared in the
256                        order: (unknown) < 'JAN' < ... < 'DEC'. The current locale
257                        determines the month spellings.
258         * <p>
259         * The option {@code "-M"} is equivalent to the {@code "--}{@link #monthSort monthSort}{@code "} option.
260         */
261        public final SortOptionSet_Mbcdfmru M = SortOptionSet_Mbcdfmru.Active_M;  
262        /**
263         * Option {@code "--monthSort"}: An initial string, consisting of any amount of blanks, followed by a
264                        month name abbreviation, is folded to UPPER case and compared in the
265                        order: (unknown) < 'JAN' < ... < 'DEC'. The current locale
266                        determines the month spellings.
267         * <p>
268         * The option {@code "--monthSort"} is equivalent to the {@code "-}{@link #M M}{@code "} option.
269         */
270        public final SortOptionSet_Mbcdfmru monthSort = SortOptionSet_Mbcdfmru.Active_M_long;  
271        /**
272         * Option {@code "-n"}: Sort numerically; the number begins each line and consists of 
273                        optional blanks, an optional minus sign, and zero or more digits
274                        possibly separated by thousands separators, optionally followed by a
275                        decimal-point character and zero or more digits. An empty number is
276                        treated as '0'. The current local specifies the decimal-point 
277                        character and thousands separator.
278                        <p>
279                        Comparison is exact; there is no rounding error.
280                        <p>
281                        Neither a leading '+' nor exponential notation is recognized. To 
282                        compare such strings numerically, use the
283                        {@code -genericNumericSort (-g)} option. 
284<p>
285                        (This option is ignored if a comparator operand is present).
286         * <p>
287         * The option {@code "-n"} is equivalent to the {@code "--}{@link #numericSort numericSort}{@code "} option.
288         */
289        public final SortOptionSet_bcdfmnru n = SortOptionSet_bcdfmnru.Active_n;  
290        /**
291         * Option {@code "--numericSort"}: Sort numerically; the number begins each line and consists of 
292                        optional blanks, an optional minus sign, and zero or more digits
293                        possibly separated by thousands separators, optionally followed by a
294                        decimal-point character and zero or more digits. An empty number is
295                        treated as '0'. The current local specifies the decimal-point 
296                        character and thousands separator.
297                        <p>
298                        Comparison is exact; there is no rounding error.
299                        <p>
300                        Neither a leading '+' nor exponential notation is recognized. To 
301                        compare such strings numerically, use the
302                        {@code -genericNumericSort (-g)} option. 
303<p>
304                        (This option is ignored if a comparator operand is present).
305         * <p>
306         * The option {@code "--numericSort"} is equivalent to the {@code "-}{@link #n n}{@code "} option.
307         */
308        public final SortOptionSet_bcdfmnru numericSort = SortOptionSet_bcdfmnru.Active_n_long;  
309        /**
310         * Option {@code "-r"}: Reverse the sense of comparisons.
311         * <p>
312         * The option {@code "-r"} is equivalent to the {@code "--}{@link #reverse reverse}{@code "} option.
313         */
314        public final SortOptionSet_MVbcdfghmnru r = SortOptionSet_MVbcdfghmnru.Active_r;  
315        /**
316         * Option {@code "--reverse"}: Reverse the sense of comparisons.
317         * <p>
318         * The option {@code "--reverse"} is equivalent to the {@code "-}{@link #r r}{@code "} option.
319         */
320        public final SortOptionSet_MVbcdfghmnru reverse = SortOptionSet_MVbcdfghmnru.Active_r_long;  
321        /**
322         * Option {@code "-u"}: Unique: suppress all but one in each set of lines having equal keys.
323                        If used with the {@code -c} option, checks that there are no lines 
324                        with duplicate keys, in addition to checking that the input file is 
325                        sorted.
326         * <p>
327         * The option {@code "-u"} is equivalent to the {@code "--}{@link #unique unique}{@code "} option.
328         */
329        public final SortOptionSet_MVbcdfghmnru u = SortOptionSet_MVbcdfghmnru.Active_u;  
330        /**
331         * Option {@code "--unique"}: Unique: suppress all but one in each set of lines having equal keys.
332                        If used with the {@code -c} option, checks that there are no lines 
333                        with duplicate keys, in addition to checking that the input file is 
334                        sorted.
335         * <p>
336         * The option {@code "--unique"} is equivalent to the {@code "-}{@link #u u}{@code "} option.
337         */
338        public final SortOptionSet_MVbcdfghmnru unique = SortOptionSet_MVbcdfghmnru.Active_u_long;  
339        /**
340         * Option {@code "-V"}: Sort by version name and number. It behaves like a standard sort, 
341                        except that each sequence of decimal digits is treated numerically 
342                        as an index/version number.
343                        <p>
344                        (This option is ignored if a comparator operand is present).
345         * <p>
346         * The option {@code "-V"} is equivalent to the {@code "--}{@link #versionSort versionSort}{@code "} option.
347         */
348        public final SortOptionSet_Vbcdfmru V = SortOptionSet_Vbcdfmru.Active_V;  
349        /**
350         * Option {@code "--versionSort"}: Sort by version name and number. It behaves like a standard sort, 
351                        except that each sequence of decimal digits is treated numerically 
352                        as an index/version number.
353                        <p>
354                        (This option is ignored if a comparator operand is present).
355         * <p>
356         * The option {@code "--versionSort"} is equivalent to the {@code "-}{@link #V V}{@code "} option.
357         */
358        public final SortOptionSet_Vbcdfmru versionSort = SortOptionSet_Vbcdfmru.Active_V_long;  
359        
360}