All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.ants.utils.KeyArgs
java.lang.Object
   |
   +----edu.utah.janos.ants.utils.KeyArgs

  Summary

public class  KeyArgs
     extends java.lang.Object
{
          // Fields 2
     private KeyArg[] args;
     private static final KeyArg empty;

          // Constructors 4
     public KeyArgs() throws InvalidKeyArgsException;
     private KeyArgs(KeyArg[]);
     public KeyArgs(String[]) throws InvalidKeyArgsException;
     public KeyArgs(String[], int) throws InvalidKeyArgsException;

          // Methods 13
     public static void noMore(KeyArgs);

     public String arg(int);
     public void compact();
     public String get(String);
     public String key(int);
     public int length();
     public void merge(KeyArgs);
     public void merge(String[]) throws InvalidKeyArgsException;
     public void merge(String[], int) throws InvalidKeyArgsException;
     public void set(String, String);
     public void strike(int);
     public String toString();
     public String[] toStrings();
}

Keyword argument manipulation utilities. These are used for handling command line arguments. The key is any string beginning with a "-"; the argument associated with the key can be any string.

WARNING: Do not try to pass an argument value of "-1" to these routines. It will be recognized as a key, not an argument. (Any negative number will do that, of course.)

XXX fix the above, somehow.

Author:
David Wetherall




  Fields

· args

Summary  |  Top

   private KeyArg[] args

Array of KeyArgs, one for each option.


· empty

Summary  |  Top
   private static final KeyArg empty

The canonical 'null argument' KeyArg.


  Constructors

· KeyArgs

Summary  |  Top

   private KeyArgs(KeyArg[] ka) 


· KeyArgs

Summary  |  Top
   public KeyArgs(String[] ka)  throws InvalidKeyArgsException


· KeyArgs

Summary  |  Top
   public KeyArgs()  throws InvalidKeyArgsException


· KeyArgs

Summary  |  Top
   public KeyArgs(String[] ka, 
                  int skip)  throws InvalidKeyArgsException


  Methods

· length

Summary  |  Top
   public int length() 

Return the number of key/arg pairs.



· key

Summary  |  Top
   public String key(int i) 

Return the i'th key.



· arg

Summary  |  Top
   public String arg(int i) 

Return the i'th argument.



· get

Summary  |  Top
   public String get(String key) 

Find the arg associated with the given key. Returns 'null' if the key isn't found.



· set

Summary  |  Top
   public void set(String key, 
                   String arg) 

Set the arg for key. Overwrites existing value for key if one is set, otherwise adds a new pair to the list.



· strike

Summary  |  Top
   public void strike(int i) 

Strike the i'th key/arg pair from the list.



· compact

Summary  |  Top
   public void compact() 

Compact the list of key/arg pairs. Removes all the "empty" ones.



· merge

Summary  |  Top
   public void merge(String[] ka)  throws InvalidKeyArgsException

Merge the given array of strings into the key/arg list.



· merge

Summary  |  Top
   public void merge(String[] ka, 
                     int skip)  throws InvalidKeyArgsException

Merge the given array of strings into the key/arg list. The first skip entries in the string array are skipped.



· merge

Summary  |  Top
   public void merge(KeyArgs k) 

Merge the given set of KeyArgs into the current list. Duplicates in k are thrown away.



· toString

Summary  |  Top
   public String toString() 

Generate a nice, readable string representation of the key/arg pairs.

Overrides:
toString in class Object


· toStrings

Summary  |  Top
   public String[] toStrings() 

Generate an array of Strings, one for each Key/Arg pair.



· noMore

Summary  |  Top
   public static void noMore(KeyArgs k) 


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7