public enum UniqOption extends Enum<UniqOption> implements Option, UniqOptions
uniq command.
For most applications, it may be more convenient to use Uniq.Options
instead of the option constants defined here.
-c | --count | Precedes each output line with a count of the number of times the line occurred in the input. | |||
-d | --duplicatedOnly | Suppresses the writing of lines that are not repeated in the input. | |||
-u | --uniqueOnly | Suppresses the writing of lines that are repeated in the input. | |||
-g | --global | Suppresses repeated lines globally, that is, if lines are non-adjacent. This option guarantees unique output lines even if the input lines are not sorted. |
UniqOptions.Default| Enum Constant and Description |
|---|
count
Option
--count, -c:
Precedes each output line with a count of the number of times the
line occurred in the input. |
duplicatedOnly
Option
--duplicatedOnly, -d:
Suppresses the writing of lines that are not repeated in the input. |
global
Option
--global, -g:
Suppresses repeated lines globally, that is, if lines are
non-adjacent. |
uniqueOnly
Option
--uniqueOnly, -u:
Suppresses the writing of lines that are repeated in the input. |
CONVERTER, EMPTY| Modifier and Type | Method and Description |
|---|---|
char |
acronym()
Returns a one letter acronym for this option.
|
EnumSet<UniqOption> |
asSet()
Returns a new set with
this active option. |
static UniqOption |
findByAcronym(char acronym)
Returns the option with the given
acronym, or null if no
such option is found. |
boolean |
isSet(UniqOption option)
Returns true if the specified
option is set and false otherwise |
Iterator<UniqOption> |
iterator()
Returns an immutable iterator returning o single element:
this
option. |
Class<UniqOption> |
optionType()
Returns the option type class, usually an enum.
|
int |
size()
Returns 1 as this is a set with a single element:
this option |
boolean |
useAcronymFor(UniqOption option)
Returns true if the
acronym should be used for
the specified option in string representations. |
static UniqOption |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static UniqOption[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final UniqOption count
--count, -c:
Precedes each output line with a count of the number of times the
line occurred in the input.public static final UniqOption duplicatedOnly
--duplicatedOnly, -d:
Suppresses the writing of lines that are not repeated in the input.public static final UniqOption uniqueOnly
--uniqueOnly, -u:
Suppresses the writing of lines that are repeated in the input.public static final UniqOption global
--global, -g:
Suppresses repeated lines globally, that is, if lines are
non-adjacent. This option guarantees unique output lines even if the
input lines are not sorted.public static UniqOption[] values()
for (UniqOption c : UniqOption.values()) System.out.println(c);
public static UniqOption valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic Class<UniqOption> optionType()
OptionSetoptionType in interface OptionSet<UniqOption>public static UniqOption findByAcronym(char acronym)
acronym, or null if no
such option is found.acronym - the option acronymacronym or null if it
is not foundpublic char acronym()
Optionpublic boolean isSet(UniqOption option)
OptionSetoption is set and false otherwiseisSet in interface OptionSet<UniqOption>option - the option to testoption is set in this OptionSetpublic EnumSet<UniqOption> asSet()
this active option.asSet in interface OptionSet<UniqOption>public Iterator<UniqOption> iterator()
this
option.iterator in interface Iterable<UniqOption>iterator in interface OptionSet<UniqOption>this active option.public int size()
this optionsize in interface OptionSet<UniqOption>public boolean useAcronymFor(UniqOption option)
acronym should be used for
the specified option in string representations.
This method returns always true for all options.
useAcronymFor in interface OptionSet<UniqOption>option - the option of interestCopyright © 2017. All Rights Reserved.