public enum Command extends Enum<Command>
fromScript(String)
or from the sed arguments
fromArgs(SedArguments)
. The constant also provides support for the
instantiation of a new command processor through
createProcessorFor(SedArguments, LineProcessor)
.Enum Constant and Description |
---|
append |
change |
delete |
insert |
print |
substitute |
translate |
Modifier and Type | Field and Description |
---|---|
protected char |
commandChar |
Modifier and Type | Method and Description |
---|---|
abstract AbstractSedProcessor |
createProcessorFor(SedArguments args,
LineProcessor output)
Returns a new instance of the appropriate sed processor for this command.
|
abstract AbstractSedProcessor |
createProcessorFor(String script,
SedArguments args,
LineProcessor output)
Returns a new instance of the appropriate sed processor for this command.
|
static Command |
fromArgs(SedArguments args)
Returns the command constant taken from the command option set in args
using the
matches(SedArguments) method Returns null if no
command option is set. |
static Command |
fromScript(String script)
Returns the command constant The first non-whitespace character of the
script defines the command for substitute and translate; for all other
commands, it is the first character after a whitespace sequence within
the script (leading whitespace is ignored).
|
abstract boolean |
matches(SedArguments args)
Returns true if the the command option for this command is set in the
specified sed arguments, and false otherwise.
|
static Command |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Command[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Command substitute
protected final char commandChar
public static Command[] values()
for (Command c : Command.values()) System.out.println(c);
public static Command 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 abstract boolean matches(SedArguments args)
args
- the sed argumentspublic abstract AbstractSedProcessor createProcessorFor(SedArguments args, LineProcessor output)
args
.args
- the sed arguments passed to the processor constructoroutput
- the output object passed to the processor constructorpublic abstract AbstractSedProcessor createProcessorFor(String script, SedArguments args, LineProcessor output)
script
- the sed script passed to the processor constructorargs
- the sed arguments passed to the processor constructoroutput
- the output object passed to the processor constructorpublic static Command fromScript(String script)
script
- the script to analysepublic static Command fromArgs(SedArguments args)
matches(SedArguments)
method Returns null if no
command option is set.args
- the sed command argumentsCopyright © 2024. All rights reserved.