frysk.hpd
Class Input

java.lang.Object
  extended by frysk.hpd.Input

 class Input
extends Object

Command input broken down into a series of parameters.


Nested Class Summary
(package private) static class Input.Token
           
 
Field Summary
private  String fullCommand
           
private  String set
           
private  List tokens
           
 
Constructor Summary
  Input(String cmd)
          The constructor.
private Input(String fullCommand, String set, List tokens)
           
 
Method Summary
(package private)  Input accept()
          Accept the current parameter; advance to the next one.
 String getFullCommand()
          getFullCommand passes a full copy of the command to the caller
 String getSet()
           
(package private)  Input.Token incompleteToken(int cursor)
          Return the 'incomplete' token that should be completed; note that an "incomplete" token has "end" set to the cursor position and not the end of the string.
(package private)  String parameter(int n)
          Return the N'th parameter.
(package private)  void removeFirst()
          Remove the first token.
(package private)  void removeLast()
          Remove the last token.
(package private)  int size()
          Return the number or size of the parameter list.
(package private)  String[] stringArrayValue()
          Return the value of the remaining input as a String[] (i.e., each token as a separate String).
(package private)  String stringValue()
          Return the value of the remaining input as a simple (raw) string.
(package private)  Input.Token token(int n)
          Return the N'th token; or null.
private  List tokenize(String str)
          Tokenize a string (probably command) minding quoted statements
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fullCommand

private final String fullCommand

set

private final String set

tokens

private final List tokens
Constructor Detail

Input

private Input(String fullCommand,
              String set,
              List tokens)

Input

public Input(String cmd)
The constructor.

Parameters:
cmd - the full preprocessed command in the form defined in HPDF: [p/t-set/prefix] verb object [option ...] [-option [value] ...]
Throws:
ParseException - thrown if error are encountered during parsing
Method Detail

getSet

public String getSet()

parameter

String parameter(int n)
Return the N'th parameter.


stringArrayValue

String[] stringArrayValue()
Return the value of the remaining input as a String[] (i.e., each token as a separate String).


stringValue

String stringValue()
Return the value of the remaining input as a simple (raw) string.


token

Input.Token token(int n)
Return the N'th token; or null.


removeFirst

void removeFirst()
Remove the first token.


removeLast

void removeLast()
Remove the last token.


size

int size()
Return the number or size of the parameter list.


toString

public String toString()
Overrides:
toString in class Object

accept

Input accept()
Accept the current parameter; advance to the next one.


tokenize

private List tokenize(String str)
Tokenize a string (probably command) minding quoted statements

Returns:
List of string tokens

incompleteToken

Input.Token incompleteToken(int cursor)
Return the 'incomplete' token that should be completed; note that an "incomplete" token has "end" set to the cursor position and not the end of the string.


getFullCommand

public String getFullCommand()
getFullCommand passes a full copy of the command to the caller

Returns:
a String containing the full command line