1 23 24 package org.enhydra.xml.xmlc.commands.options; 25 26 import java.util.ArrayList ; 27 import java.util.HashMap ; 28 import java.util.Iterator ; 29 30 36 public class OptionSet { 37 40 private ArrayList optionList = new ArrayList (); 41 42 45 private HashMap options = new HashMap (); 46 47 50 public void addOption(Option opt) { 51 optionList.add(opt); 52 options.put(opt.getName(), opt); 53 } 54 55 58 public Iterator getOptions() { 59 return optionList.iterator(); 60 } 61 62 65 public String getOptionsMsg() { 66 StringBuffer msg = new StringBuffer (); 67 Iterator opts = getOptions(); 68 69 while (opts.hasNext()) { 70 Option opt = (Option)opts.next(); 71 msg.append(" "); 72 msg.append(opt.getHelp()); 73 msg.append("\n"); 74 } 75 return msg.toString(); 76 } 77 78 84 public Option findOption(String name) { 85 return (Option)options.get(name); 86 } 87 } 88 | Popular Tags |