< prev index next >

src/com/sun/javatest/tool/Command.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 113     protected void addArg(String arg) {
 114         args.add(arg);
 115     }
 116 
 117     /**
 118      * Get another argument from the iterator, and add it to the argument array.
 119      * @param argIter the iterator from which to get the next argument
 120      * @return the next argument from the iterator
 121      */
 122     protected String nextArg(Iterator<String> argIter) {
 123         String s = argIter.next();
 124         addArg(s);
 125         return s;
 126     }
 127 
 128     /**
 129      * Back up the iterator to reject an argument, and remove the corresponding
 130      * entry from the argument array.
 131      * @param argIter the iterator from which teh argument was obtained
 132      */
 133     protected void putbackArg(ListIterator argIter) {
 134         argIter.previous();
 135         args.remove(args.size() - 1);
 136     }
 137 
 138     /**
 139      * Get the array of arguments for this command.
 140      * The first element in the array will be the command name;
 141      * the subsequent arguments will be the ones added by the addArg method.
 142      * @return the array of arguments for this command
 143      */
 144     public String[] getArgs() {
 145         String[] a = new String[args.size()];
 146         args.copyInto(a);
 147         return a;
 148     }
 149 
 150     /**
 151      * Get a printable representation of this command.
 152      * The string is composed of the entries in the argument array.
 153      * @return a printable representation of this command




 113     protected void addArg(String arg) {
 114         args.add(arg);
 115     }
 116 
 117     /**
 118      * Get another argument from the iterator, and add it to the argument array.
 119      * @param argIter the iterator from which to get the next argument
 120      * @return the next argument from the iterator
 121      */
 122     protected String nextArg(Iterator<String> argIter) {
 123         String s = argIter.next();
 124         addArg(s);
 125         return s;
 126     }
 127 
 128     /**
 129      * Back up the iterator to reject an argument, and remove the corresponding
 130      * entry from the argument array.
 131      * @param argIter the iterator from which teh argument was obtained
 132      */
 133     protected void putbackArg(ListIterator<String> argIter) {
 134         argIter.previous();
 135         args.remove(args.size() - 1);
 136     }
 137 
 138     /**
 139      * Get the array of arguments for this command.
 140      * The first element in the array will be the command name;
 141      * the subsequent arguments will be the ones added by the addArg method.
 142      * @return the array of arguments for this command
 143      */
 144     public String[] getArgs() {
 145         String[] a = new String[args.size()];
 146         args.copyInto(a);
 147         return a;
 148     }
 149 
 150     /**
 151      * Get a printable representation of this command.
 152      * The string is composed of the entries in the argument array.
 153      * @return a printable representation of this command


< prev index next >