public enum WcOption extends Enum<WcOption> implements Option, WcOptions
wc
command.
For most applications, it may be more convenient to use Wc.Options
instead of the option constants defined here.
-l | --lines | Executes a count of lines and writes this count to the output. | |||
-w | --words | Executes a count of words and writes this count to the output. A
word is a non-zero-length string of characters delimited by white
space as defined by Character.isWhitespace(char) . | |||
-m | --chars | Executes a count of chars and writes this count to the output. |
WcOptions.Default
Enum Constant and Description |
---|
chars
Option
--chars , -m :
Executes a count of chars and writes this count to the output. |
lines
Option
--lines , -l :
Executes a count of lines and writes this count to the output. |
words
Option
--words , -w :
Executes a count of words and writes this count to the output. |
Modifier and Type | Method and Description |
---|---|
char |
acronym()
Returns a one letter acronym for this option.
|
EnumSet<WcOption> |
asSet()
Returns a new set with
this active option. |
static WcOption |
findByAcronym(char acronym)
Returns the option with the given
acronym , or null if no
such option is found. |
boolean |
isSet(WcOption option)
Returns true if the specified
option is set and false otherwise |
Iterator<WcOption> |
iterator()
Returns an immutable iterator returning o single element:
this
option. |
Class<WcOption> |
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(WcOption option)
Returns true if the
acronym should be used for
the specified option in string representations. |
static WcOption |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static WcOption[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
forEach, spliterator
public static final WcOption lines
--lines
, -l
:
Executes a count of lines and writes this count to the output.public static final WcOption words
--words
, -w
:
Executes a count of words and writes this count to the output. A
word is a non-zero-length string of characters delimited by white
space as defined by Character.isWhitespace(char)
.public static WcOption[] values()
for (WcOption c : WcOption.values()) System.out.println(c);
public static WcOption 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<WcOption> optionType()
OptionSet
optionType
in interface OptionSet<WcOption>
public static WcOption findByAcronym(char acronym)
acronym
, or null
if no
such option is found.acronym
- the option acronym
acronym
or null
if it
is not foundpublic char acronym()
Option
public boolean isSet(WcOption option)
OptionSet
option
is set and false otherwisepublic Iterator<WcOption> iterator()
this
option.public int size()
this
optionpublic boolean useAcronymFor(WcOption option)
acronym
should be used for
the specified option
in string representations.
This method returns always true for all options.
useAcronymFor
in interface OptionSet<WcOption>
option
- the option of interestCopyright © 2024. All rights reserved.