com.SoftWoehr.JTOpenContrib.MEU
Class MEUCommand

java.lang.Object
  |
  +--com.SoftWoehr.JTOpenContrib.MEU.MEUCommand

public class MEUCommand
extends java.lang.Object

Embodies command parsing from the command line at the top of the MEU editor.


Constructor Summary
MEUCommand(java.lang.String s)
          Parse a string to create a new MEUCommand
 
Method Summary
 java.lang.String getArgString()
          Get the arg string without the command
 boolean getBeforeNotAfter()
          If processMoveCopySpecs() is called successfully, if true, move before, otherwise, after.
 java.lang.String getChangeBufferRange()
          Return the "*" or number spec for number of changes in buffer instanced by successful processChangeSpecs().
 java.lang.String getChangeLineRange()
          Return the "*" or number spec for number of changes in line instanced by successful processChangeSpecs().
 java.lang.String getChangeMod()
          Return the change mod (the changed string) from a change specification instanced by successful processChangeSpecs().
 java.lang.String getChangeTarget()
          Return the change target from a change specification instanced by successful processChangeSpecs().
 java.lang.String getCommand()
          Get the command
 java.lang.String getCommandString()
          Get the original command string
static int getConvertedChangeRange(java.lang.String changeRange)
          Returns int number of changes or -1 for "*".
 int getMoveCopyNumber()
          If processMoveCopySpecs() is called successfully, the number of lines to copy/move
 int getMoveCopyStart()
          If processMoveCopySpecs() is called successfully, the first line to copy/move
 int getMoveCopyTarget()
          If processMoveCopySpecs() is called successfully, the line move/copy before/after.
static void main(java.lang.String[] argv)
          Show and test use of MEUCommand
 java.lang.String nthArg(int n)
          Get the nth argument
 int numArgs()
          Get the number of args to the command
 boolean processChangeSpecs()
          Used by a CHANGE command to process the change specification.
 boolean processMoveCopySpecs()
          Used by a MOVE or COPY command to process the specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MEUCommand

public MEUCommand(java.lang.String s)
Parse a string to create a new MEUCommand
Parameters:
s - The command as entered by user.
Method Detail

getCommandString

public java.lang.String getCommandString()
Get the original command string
Returns:
What the user entered.

getCommand

public java.lang.String getCommand()
Get the command
Returns:
Uppercased COMMAND from the command string entered by user.

numArgs

public int numArgs()
Get the number of args to the command
Returns:
number of space-delimited args.

nthArg

public java.lang.String nthArg(int n)
Get the nth argument
Parameters:
n - Zero-based index of argument (not including command itself).
Returns:
Argument or null.

getArgString

public java.lang.String getArgString()
Get the arg string without the command
Returns:
Arugment portion of user entry, as originally entered (no case conversion).

processChangeSpecs

public boolean processChangeSpecs()
Used by a CHANGE command to process the change specification. After this returns 'true' the getChange*() funcs are valid, before, not.
Returns:
True on success.

getChangeTarget

public java.lang.String getChangeTarget()
Return the change target from a change specification instanced by successful processChangeSpecs().
Returns:
The string looked for to change.

getChangeMod

public java.lang.String getChangeMod()
Return the change mod (the changed string) from a change specification instanced by successful processChangeSpecs().
Returns:
The change text to replace the sought string.

getChangeLineRange

public java.lang.String getChangeLineRange()
Return the "*" or number spec for number of changes in line instanced by successful processChangeSpecs().
Returns:
"*" or number spec for number of changes in line

getConvertedChangeRange

public static int getConvertedChangeRange(java.lang.String changeRange)
                                   throws java.lang.NumberFormatException
Returns int number of changes or -1 for "*". If not a "*" and non-convertible, throws.
Parameters:
changeRange - String value for this parameter as entered by user.
Returns:
Number of changes or -1 for "*"
Throws:
java.lang.NumberFormatException - changRange was neither "*" nor a base10 int.

getChangeBufferRange

public java.lang.String getChangeBufferRange()
Return the "*" or number spec for number of changes in buffer instanced by successful processChangeSpecs().
Returns:
Number of rows to change or -1 for "*"

processMoveCopySpecs

public boolean processMoveCopySpecs()
                             throws java.lang.NumberFormatException
Used by a MOVE or COPY command to process the specification. After this returns 'true' the getMoveCopy*() funcs are valid, before, not.
Returns:
true on success.
Throws:
java.lang.NumberFormatException - If some numeric value in the specs is not a base10 int.

getMoveCopyStart

public int getMoveCopyStart()
If processMoveCopySpecs() is called successfully, the first line to copy/move
Returns:
First line number to move/copy.

getMoveCopyNumber

public int getMoveCopyNumber()
If processMoveCopySpecs() is called successfully, the number of lines to copy/move
Returns:
number of lines to move/copy.

getMoveCopyTarget

public int getMoveCopyTarget()
If processMoveCopySpecs() is called successfully, the line move/copy before/after.
Returns:
Number of line to move/copy before/after

getBeforeNotAfter

public boolean getBeforeNotAfter()
If processMoveCopySpecs() is called successfully, if true, move before, otherwise, after.
Returns:
true if BEFORE false if AFTER

main

public static void main(java.lang.String[] argv)
Show and test use of MEUCommand
Parameters:
argv - Command line for MEU.