1 26 27 package org.objectweb.util.cmdline.lib; 28 29 import org.objectweb.util.cmdline.api.CommandLine; 30 import org.objectweb.util.cmdline.api.Iterator; 31 32 45 46 public class DefaultIterator 47 extends DefaultCommandLineHolder 48 implements Iterator 49 { 50 56 57 protected String current_ = null; 58 59 60 private java.util.Vector arguments_; 61 62 63 protected java.util.Iterator iterator_; 64 65 71 77 public 78 DefaultIterator(String [] args, 79 CommandLine commandLine) 80 { 81 super(commandLine); 83 84 current_ = null; 86 87 arguments_ = new java.util.Vector (); 88 for(int i=0; i<args.length; i++) 89 arguments_.addElement(args[i]); 90 91 iterator_ = arguments_.iterator(); 92 } 93 94 100 105 protected String [] 106 getUnparsedArguments() 107 { 108 return ((String [])(arguments_.toArray(new String [0]))); 109 } 110 111 117 122 public String 123 getCurrent() 124 { 125 return current_; 126 } 127 128 135 public boolean 136 hasNext() 137 { 138 return iterator_.hasNext(); 139 } 140 141 149 public String 150 next() 151 { 152 current_ = (String )iterator_.next(); 153 return current_; 154 } 155 156 160 public void 161 remove() 162 { 163 current_ = null; 164 iterator_.remove(); 165 } 166 167 } 173 | Popular Tags |