2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.bin.argparser;
23 import jalview.bin.argparser.Arg.Opt;
24 import jalview.bin.argparser.Arg.Type;
27 * A helper class to keep an index of argument position with argument values
29 public class ArgValue implements Comparable<ArgValue>
38 * Type type is only really used by --help-type
40 private Type type = null;
43 * This id is set by a subVal id= to identify the product of this ArgValue
44 * later. Set but not currently used.
48 private SubVals subVals;
50 protected ArgValue(Arg a, SubVals sv, Type type, String content,
55 this.argIndex = argIndex;
56 this.subVals = sv == null ? new SubVals("") : sv;
60 protected ArgValue(Arg a, Type type, String value, int argIndex)
63 this.argIndex = argIndex;
64 this.subVals = new SubVals(value);
65 this.value = getSubVals().getContent();
69 protected void setType(Type t)
71 if (this.getArg().hasOption(Opt.HASTYPE))
85 public String getValue()
90 public int getArgIndex()
95 protected void setId(String i)
100 public String getId()
105 public SubVals getSubVals()
110 public String getSubVal(String key)
112 if (subVals == null || !subVals.has(key))
114 return subVals.get(key);
117 protected void putSubVal(String key, String val)
119 this.subVals.put(key, val);
123 public final int compareTo(ArgValue o)
125 return this.getArgIndex() - o.getArgIndex();