Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 16:11:35 GMT
  2. Package jalview.bin.argparser

File ArgValuesMap.java

 

Coverage histogram

../../../img/srcFileCovDistChart7.png
30% of files have more coverage

Code metrics

152
239
50
3
749
591
165
0.69
4.78
16.67
3.3

Classes

Class Line # Actions
ArgValuesMap 44 230 159
0.6948356669.5%
ArgValuesMap.ArgInfo 700 9 6
0.00%
ArgValuesMap.Position 745 0 0
-1.0 -
 

Contributing tests

This file is covered by 96 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.bin.argparser;
22   
23    import java.io.File;
24    import java.util.ArrayList;
25    import java.util.Arrays;
26    import java.util.Collections;
27    import java.util.HashMap;
28    import java.util.HashSet;
29    import java.util.List;
30    import java.util.Locale;
31    import java.util.Map;
32    import java.util.Set;
33   
34    import jalview.bin.Cache;
35    import jalview.bin.Console;
36    import jalview.bin.argparser.Arg.Opt;
37    import jalview.bin.argparser.Arg.Type;
38    import jalview.util.FileUtils;
39   
40    /**
41    * Helper class to allow easy extraction of information about specific argument
42    * values (without having to check for null etc all the time)
43    */
 
44    public class ArgValuesMap
45    {
46    private List<ArgInfo> argInfoList = new ArrayList<>();
47   
48    protected Map<Arg, ArgValues> m;
49   
50    private String linkedId;
51   
 
52  646 toggle protected ArgValuesMap(String linkedId)
53    {
54  646 this.linkedId = linkedId;
55  646 this.newMap();
56    }
57   
 
58  0 toggle protected ArgValuesMap(String linkedId, Map<Arg, ArgValues> map)
59    {
60  0 this.linkedId = linkedId;
61  0 this.m = map;
62    }
63   
 
64  617 toggle public String getLinkedId()
65    {
66  617 return linkedId;
67    }
68   
 
69  0 toggle private Map<Arg, ArgValues> getMap()
70    {
71  0 return m;
72    }
73   
 
74  646 toggle private void newMap()
75    {
76  646 m = new HashMap<Arg, ArgValues>();
77    }
78   
 
79  1021 toggle private void newArg(Arg a)
80    {
81  1021 if (m == null)
82    {
83  0 newMap();
84    }
85  1021 if (!containsArg(a))
86    {
87  1021 m.put(a, new ArgValues(a, this));
88    }
89    }
90   
 
91  4172 toggle public ArgValues getArgValues(Arg a)
92    {
93  4172 return m == null ? null : m.get(a);
94    }
95   
 
96  1138 toggle public ArgValues getOrCreateArgValues(Arg a)
97    {
98  1138 ArgValues avs = m.get(a);
99  1138 if (avs == null)
100  1021 newArg(a);
101  1138 return getArgValues(a);
102    }
103   
 
104  2170 toggle public List<ArgValue> getArgValueList(Arg a)
105    {
106  2170 ArgValues avs = getArgValues(a);
107  2170 return avs == null ? new ArrayList<>() : avs.getArgValueList();
108    }
109   
 
110  5 toggle public List<ArgValue> getArgValueListFromSubValOrArg(ArgValue av, Arg a,
111    SubVals sv)
112    {
113  5 return getArgValueListFromSubValArgOrPrefWithSubstitutionsWithinTypes(
114    null, a, Position.AFTER, av, sv, null, null, null, true, null);
115    }
116   
 
117  5 toggle public List<ArgValue> getArgValueListFromSubValArgOrPrefWithSubstitutionsWithinTypes(
118    ArgParser ap, Arg a, ArgValuesMap.Position pos, ArgValue av,
119    SubVals sv, String key, String pref, String def,
120    boolean withinTypes, Type type)
121    {
122  5 if (key == null)
123    {
124  5 key = a.getName();
125    }
126  5 Set<Type> types = new HashSet<>();
127  5 if (type == null)
128    {
129  5 types.addAll(Arrays.asList(av.getArg().getTypes()));
130    }
131    else
132    {
133  0 types.add(type);
134    }
135  5 List<ArgValue> avList = new ArrayList<>();
136  5 if (sv != null && sv.has(key) && sv.get(key) != null)
137    {
138  0 String value = ap == null ? sv.get(key)
139    : sv.getWithSubstitutions(ap, getLinkedId(), key);
140    // protected ArgValue(Arg a, SubVals sv, Type type, String content, int
141    // argIndex)
142   
143  0 ArgValue svav = new ArgValue(a, null, null, value, av.getArgIndex(),
144    false, null, this.getLinkedId());
145  0 avList.add(svav);
146    }
147  5 else if (containsArg(a))
148    {
149  5 if (pos == ArgValuesMap.Position.FIRST && getValue(a) != null)
150  0 avList.add(getArgValue(a));
151  5 else if (pos == ArgValuesMap.Position.BEFORE
152    && getClosestPreviousArgValueOfArg(av, a) != null)
153    {
154  0 for (ArgValue tmpAv : getArgValues(a).getArgValueList())
155    {
156  0 if (tmpAv.getArgIndex() >= av.getArgIndex())
157    {
158  0 continue;
159    }
160  0 avList.add(tmpAv);
161    }
162    }
163  5 else if (pos == ArgValuesMap.Position.AFTER
164    && getClosestNextArgValueOfArg(av, a, withinTypes) != null)
165    {
166  5 for (ArgValue tmpAv : getArgValues(a).getArgValueList())
167    {
168  35 if (tmpAv.getArgIndex() <= av.getArgIndex())
169    {
170  13 continue;
171    }
172  22 avList.add(tmpAv);
173    }
174    }
175    }
176   
177    // check if withinType the avs don't belong to the next primary arg
178    // of this type. Checking for *any* shared type.
179  5 if (withinTypes && !avList.isEmpty())
180    {
181  5 int nextPrimaryArgOfSameTypeIndex = Integer.MAX_VALUE;
182    // run through every Arg used in this ArgValuesMap
183  5 for (Arg tmpA : this.getArgKeys())
184    {
185    // only interested in looking up to next Opt.PRIMARY args of the same
186    // type as av (or provided type)
187  44 if (tmpA.hasType(types) && tmpA.hasOption(Opt.PRIMARY))
188    {
189  5 for (ArgValue tmpAv : getArgValueList(tmpA))
190    {
191  13 int tmpArgIndex = tmpAv.getArgIndex();
192  13 if (tmpArgIndex > av.getArgIndex()
193    && tmpArgIndex < nextPrimaryArgOfSameTypeIndex)
194    {
195  3 nextPrimaryArgOfSameTypeIndex = tmpArgIndex;
196    }
197    }
198    }
199    }
200  5 List<ArgValue> tmpList = new ArrayList<>();
201  5 for (ArgValue tmpAv : avList)
202    {
203  22 int tmpAvIndex = tmpAv.getArgIndex();
204  22 if (av.getArgIndex() < tmpAvIndex
205    && tmpAvIndex < nextPrimaryArgOfSameTypeIndex)
206    {
207  13 tmpList.add(tmpAv);
208    }
209    }
210  5 avList = tmpList;
211    }
212   
213  5 return avList;
214    }
215   
 
216  1157 toggle public ArgValue getArgValue(Arg a)
217    {
218  1157 List<ArgValue> vals = getArgValueList(a);
219  1157 return (vals == null || vals.size() == 0) ? null : vals.get(0);
220    }
221   
 
222  342 toggle public String getValue(Arg a)
223    {
224  342 ArgValue av = getArgValue(a);
225  342 return av == null ? null : av.getValue();
226    }
227   
 
228  308 toggle public List<String> getValues(Arg a)
229    {
230  308 return toValues(getArgValueList(a));
231    }
232   
 
233  325 toggle public static List<String> toValues(List<ArgValue> avl)
234    {
235  325 if (avl == null)
236    {
237  0 return null;
238    }
239  325 List<String> vl = new ArrayList<>();
240  325 for (ArgValue av : avl)
241    {
242  37 vl.add(av.getValue());
243    }
244  325 return vl;
245    }
246   
 
247  4605 toggle public boolean containsArg(Arg a)
248    {
249  4605 if (m == null || !m.containsKey(a))
250  3776 return false;
251  829 return a.hasOption(Opt.STRING) ? getArgValue(a) != null : true;
252    }
253   
 
254  0 toggle public boolean hasValue(Arg a, String val)
255    {
256  0 if (m == null || !m.containsKey(a))
257  0 return false;
258  0 for (ArgValue av : getArgValueList(a))
259    {
260  0 String avVal = av.getValue();
261  0 if ((val == null && avVal == null)
262    || (val != null && val.equals(avVal)))
263    {
264  0 return true;
265    }
266    }
267  0 return false;
268    }
269   
 
270  497 toggle public boolean getBoolean(Arg a)
271    {
272  497 ArgValues av = getArgValues(a);
273  497 return av == null ? false : av.getBoolean();
274    }
275   
 
276  334 toggle public Set<Arg> getArgKeys()
277    {
278  334 return m.keySet();
279    }
280   
 
281  7 toggle public ArgValue getArgValueOfArgWithSubValKey(Arg a, String svKey)
282    {
283  7 return getArgValueOfArgWithSubValKey(a, svKey, false);
284    }
285   
 
286  7 toggle public ArgValue getArgValueOfArgWithSubValKey(Arg a, String svKey,
287    boolean last)
288    {
289  7 ArgValues avs = this.getArgValues(a);
290  7 if (avs == null)
291    {
292  0 return null;
293    }
294  7 List<ArgValue> compareAvs = avs.getArgValueList();
295  15 for (int i = 0; i < compareAvs.size(); i++)
296    {
297  10 int index = last ? compareAvs.size() - 1 - i : i;
298  10 ArgValue av = compareAvs.get(index);
299  10 SubVals sv = av.getSubVals();
300  10 if (sv.has(svKey) && !sv.get(svKey).equals("false"))
301    {
302  2 return av;
303    }
304    }
305  5 return null;
306    }
307   
 
308  0 toggle public ArgValue getClosestPreviousArgValueOfArg(ArgValue thisAv, Arg a)
309    {
310  0 ArgValue closestAv = null;
311  0 int thisArgIndex = thisAv.getArgIndex();
312  0 ArgValues compareAvs = this.getArgValues(a);
313  0 int closestPreviousIndex = -1;
314  0 for (ArgValue av : compareAvs.getArgValueList())
315    {
316  0 int argIndex = av.getArgIndex();
317  0 if (argIndex < thisArgIndex && argIndex > closestPreviousIndex)
318    {
319  0 closestPreviousIndex = argIndex;
320  0 closestAv = av;
321    }
322    }
323  0 return closestAv;
324    }
325   
 
326  266 toggle public ArgValue getClosestNextArgValueOfArg(ArgValue thisAv, Arg a,
327    boolean withinTypes)
328    {
329    // this looks for the *next* arg that *might* be referring back to
330    // a thisAv. Such an arg would have no subValues (if it does it should
331    // specify an id in the subValues so wouldn't need to be guessed).
332  266 ArgValue closestAv = null;
333  266 int thisArgIndex = thisAv.getArgIndex();
334  266 if (!containsArg(a))
335  27 return null;
336  239 ArgValues compareAvs = this.getArgValues(a);
337  239 int closestNextIndex = Integer.MAX_VALUE;
338  239 for (ArgValue av : compareAvs.getArgValueList())
339    {
340  703 int argIndex = av.getArgIndex();
341  703 if (argIndex > thisArgIndex && argIndex < closestNextIndex)
342    {
343  232 closestNextIndex = argIndex;
344  232 closestAv = av;
345    }
346    }
347   
348    // check if withinType this closestAv doesn't belong to the next primary arg
349    // of this type. Checking for *any* shared type.
350  239 if (withinTypes && closestAv != null)
351    {
352  232 int nextPrimaryArgOfSameTypeIndex = Integer.MAX_VALUE;
353  232 for (Arg tmpA : this.getArgKeys())
354    {
355    // interested in Opt.PRIMARY args of the same type
356  1616 if (tmpA.sharesType(a) && tmpA.hasOption(Opt.PRIMARY))
357    {
358  239 for (ArgValue tmpAv : getArgValueList(tmpA))
359    {
360  937 int tmpArgIndex = tmpAv.getArgIndex();
361  937 if (tmpArgIndex > thisArgIndex
362    && tmpArgIndex < nextPrimaryArgOfSameTypeIndex)
363    {
364  135 nextPrimaryArgOfSameTypeIndex = tmpArgIndex;
365    }
366    }
367    }
368    }
369  232 if (nextPrimaryArgOfSameTypeIndex < closestAv.getArgIndex())
370    {
371    // looks like closestAv actually belongs to a different primary Arg
372  22 return null;
373    }
374    }
375   
376  217 return closestAv;
377    }
378   
379    // TODO this is incomplete and currently unused (fortunately)
 
380  0 toggle public ArgValue[] getArgValuesReferringTo(String key, String value, Arg a)
381    {
382    // this looks for the *next* arg that *might* be referring back to
383    // a thisAv. Such an arg would have no subValues (if it does it should
384    // specify an id in the subValues so wouldn't need to be guessed).
385  0 List<ArgValue> avList = new ArrayList<>();
386  0 Arg[] args = a == null ? (Arg[]) this.getMap().keySet().toArray()
387    : new Arg[]
388    { a };
389  0 for (Arg keyArg : args)
390    {
391  0 for (ArgValue av : this.getArgValueList(keyArg))
392    {
393   
394    }
395    }
396  0 return (ArgValue[]) avList.toArray();
397    }
398   
 
399  0 toggle public boolean hasId(Arg a, String id)
400    {
401  0 ArgValues avs = this.getArgValues(a);
402  0 return avs == null ? false : avs.hasId(id);
403    }
404   
 
405  0 toggle public ArgValue getId(Arg a, String id)
406    {
407  0 ArgValues avs = this.getArgValues(a);
408  0 return avs == null ? null : avs.getId(id);
409    }
410   
411    /*
412    * This method returns the basename of the first --append or --open value.
413    * Used primarily for substitutions in output filenames.
414    */
 
415  74 toggle public String getBasename()
416    {
417  74 return getDirBasenameOrExtension(false, false, false);
418    }
419   
420    /*
421    * This method returns the basename of the first --append or --open value.
422    * Used primarily for substitutions in output filenames.
423    */
 
424  0 toggle public String getExtension()
425    {
426  0 return getDirBasenameOrExtension(false, true, false);
427    }
428   
429    /*
430    * This method returns the dirname of the first --append or --open value.
431    * Used primarily for substitutions in output filenames.
432    */
 
433  86 toggle public String getDirname()
434    {
435  86 return getDirBasenameOrExtension(true, false, false);
436    }
437   
 
438  160 toggle public String getDirBasenameOrExtension(boolean dirname,
439    boolean extension, boolean absoluteDirname)
440    {
441  160 String filename = null;
442  160 String appendVal = getValue(Arg.APPEND);
443  160 String openVal = getValue(Arg.OPEN);
444  160 if (appendVal != null)
445  28 filename = appendVal;
446  160 if (filename == null && openVal != null)
447  132 filename = openVal;
448  160 if (filename == null)
449  0 return null;
450   
451  160 File file = new File(filename);
452  160 if (dirname)
453    {
454  86 return FileUtils.getDirname(file);
455    }
456  74 return extension ? FileUtils.getExtension(file)
457    : FileUtils.getBasename(file);
458    }
459   
460    /*
461    * Checks if there is an Arg with Opt
462    */
 
463  97 toggle public boolean hasArgWithOption(Opt o)
464    {
465  97 for (Arg a : getArgKeys())
466    {
467  102 if (a.hasOption(o))
468  97 return true;
469    }
470  0 return false;
471    }
472   
473    /*
474    * ArgInfo is a more straightforward list of arguments and their info
475    */
476   
 
477  0 toggle public void addArgInfo(Arg arg, String value, SubVals subVals,
478    int argIndex)
479    {
480  0 argInfoList.add(new ArgInfo(arg, value, subVals, argIndex));
481    }
482   
 
483  0 toggle public List<ArgInfo> getArgInfoList()
484    {
485  0 Collections.sort(argInfoList);
486  0 return argInfoList;
487    }
488   
489    /**
490    * get from all args in this ArgValuesMap and from the given subvals
491    */
 
492  308 toggle public List<String> getValuesFromSubValOrArgs(ArgParser ap, Arg a,
493    SubVals sv)
494    {
495  308 List<String> vals = new ArrayList<>();
496  308 String key = a.getName();
497  308 if (sv != null && sv.has(key) && sv.get(key) != null)
498    {
499  0 String value = ap == null ? sv.get(key)
500    : sv.getWithSubstitutions(ap, getLinkedId(), key);
501  0 if (value != null)
502    {
503  0 vals.add(value);
504    }
505    }
506  308 vals.addAll(getValues(a));
507  308 return vals;
508    }
509   
510    /**
511    * get from following Arg of type a or subval of same name (lowercase)
512    */
 
513  401 toggle public String getValueFromSubValOrArg(ArgValue av, Arg a, SubVals sv)
514    {
515  401 return getFromSubValArgOrPref(av, a, sv, null, null, null);
516    }
517   
518    /**
519    * get from following Arg of type a or subval key or preference pref or
520    * default def
521    */
 
522  709 toggle public String getFromSubValArgOrPref(ArgValue av, Arg a, SubVals sv,
523    String key, String pref, String def)
524    {
525  709 return getFromSubValArgOrPref(a, Position.AFTER, av, sv, key, pref,
526    def);
527    }
528   
529    /**
530    * get from following(AFTER), first occurence of (FIRST) or previous (BEFORE)
531    * Arg of type a or subval key or preference pref or default def
532    */
 
533  761 toggle public String getFromSubValArgOrPref(Arg a, Position pos, ArgValue av,
534    SubVals sv, String key, String pref, String def)
535    {
536  761 return getFromSubValArgOrPrefWithSubstitutions(null, a, pos, av, sv,
537    key, pref, def);
538    }
539   
 
540  887 toggle public String getFromSubValArgOrPrefWithSubstitutions(ArgParser ap, Arg a,
541    Position pos, ArgValue av, SubVals sv, String key, String pref,
542    String def)
543    {
544  887 return getFromSubValArgOrPrefWithSubstitutionsWithinTypes(ap, a, pos,
545    av, sv, key, pref, def, true);
546    }
547   
 
548  887 toggle public String getFromSubValArgOrPrefWithSubstitutionsWithinTypes(
549    ArgParser ap, Arg a, Position pos, ArgValue av, SubVals sv,
550    String key, String pref, String def, boolean withinTypes)
551    {
552  887 if (key == null)
553  887 key = a.getName();
554  887 String value = null;
555  887 if (sv != null && sv.has(key) && sv.get(key) != null)
556    {
557  12 value = ap == null ? sv.get(key)
558    : sv.getWithSubstitutions(ap, getLinkedId(), key);
559    }
560  875 else if (containsArg(a))
561    {
562  124 if (pos == ArgValuesMap.Position.FIRST && getValue(a) != null)
563  0 value = getValue(a);
564  124 else if (pos == ArgValuesMap.Position.BEFORE
565    && getClosestPreviousArgValueOfArg(av, a) != null)
566  0 value = getClosestPreviousArgValueOfArg(av, a).getValue();
567  124 else if (pos == ArgValuesMap.Position.AFTER
568    && getClosestNextArgValueOfArg(av, a, withinTypes) != null)
569  95 value = getClosestNextArgValueOfArg(av, a, withinTypes).getValue();
570   
571    // look for allstructures subval for Type.STRUCTURE
572  124 Arg arg = av.getArg();
573  124 if (value == null && arg.hasOption(Opt.PRIMARY)
574    && arg.hasType(Type.STRUCTURE) && !a.hasOption(Opt.PRIMARY)
575    && (a.getFirstType() == Type.STRUCTURE
576    // || a.getType() == Type.STRUCTUREIMAGE))
577    ))
578    {
579  7 ArgValue av2 = getArgValueOfArgWithSubValKey(a,
580    Arg.ALLSTRUCTURES.getName());
581  7 if (av2 != null)
582    {
583  2 value = av2.getValue();
584    }
585    }
586   
587  124 if (value == null)
588    {
589    // look for --all --a occurrences
590  27 for (ArgValue tmpAv : this.getArgValueList(a))
591    {
592  91 if (tmpAv.setByWildcardLinkedId())
593    {
594  13 value = tmpAv.getValue();
595    }
596    }
597    }
598    }
599  887 if (value == null)
600    {
601  765 value = pref != null ? Cache.getDefault(pref, def) : def;
602    }
603  887 return value;
604    }
605   
 
606  28 toggle public boolean getBoolFromSubVal(Arg a, SubVals sv, boolean def)
607    {
608  28 return getFromSubValArgOrPref(a, sv, null, null, def);
609    }
610   
 
611  154 toggle public boolean getBoolFromSubValOrArg(Arg a, SubVals sv)
612    {
613  154 return getFromSubValArgOrPref(a, sv, null, null, false);
614    }
615   
 
616  1028 toggle public boolean getFromSubValArgOrPref(Arg a, SubVals sv, String key,
617    String pref, boolean def)
618    {
619  1028 return getFromSubValArgOrPref(a, sv, key, pref, def, false);
620    }
621   
 
622  1070 toggle public boolean getFromSubValArgOrPref(Arg a, SubVals sv, String key,
623    String pref, boolean def, boolean invertPref)
624    {
625  1070 if ((key == null && a == null) || (sv == null && a == null))
626  0 return false;
627   
628  1070 boolean usingArgKey = false;
629  1070 if (key == null)
630    {
631  1070 key = a.getName();
632  1070 usingArgKey = true;
633    }
634   
635  1070 String nokey = ArgParser.NEGATESTRING + key;
636   
637    // look for key or nokey in subvals first (if using Arg check options)
638  1070 if (sv != null)
639    {
640    // check for true boolean
641  1070 if (sv.has(key) && sv.get(key) != null)
642    {
643  2 if (usingArgKey)
644    {
645  2 if (!(a.hasOption(Opt.BOOLEAN) || a.hasOption(Opt.UNARY)))
646    {
647  0 Console.debug(
648    "Looking for boolean in subval from non-boolean/non-unary Arg "
649    + a.getName());
650  0 return false;
651    }
652    }
653  2 return sv.get(key).toLowerCase(Locale.ROOT).equals("true");
654    }
655   
656    // check for negative boolean (subval "no..." will be "true")
657  1068 if (sv.has(nokey) && sv.get(nokey) != null)
658    {
659  0 if (usingArgKey)
660    {
661  0 if (!(a.hasOption(Opt.BOOLEAN)))
662    {
663  0 Console.debug(
664    "Looking for negative boolean in subval from non-boolean Arg "
665    + a.getName());
666  0 return false;
667    }
668    }
669  0 return !sv.get(nokey).toLowerCase(Locale.ROOT).equals("true");
670    }
671    }
672   
673    // check argvalues
674  1068 if (containsArg(a))
675  35 return getBoolean(a);
676   
677    // return preference or default
678  1033 boolean prefVal = pref != null ? Cache.getDefault(pref, def) : false;
679  812 return pref != null ? (invertPref ? !prefVal : prefVal) : def;
680    }
681   
 
682  0 toggle @Override
683    public String toString()
684    {
685  0 StringBuilder sb = new StringBuilder();
686  0 for (Arg a : this.getArgKeys())
687    {
688  0 sb.append(a.argString());
689  0 sb.append(":\n");
690  0 for (ArgValue av : this.getArgValueList(a))
691    {
692  0 sb.append(" ");
693  0 sb.append(av.getValue());
694  0 sb.append("\n");
695    }
696    }
697  0 return sb.toString();
698    }
699   
 
700    public class ArgInfo implements Comparable<ArgInfo>
701    {
702    private Arg arg;
703   
704    private String value;
705   
706    private SubVals subVals;
707   
708    private int argIndex;
709   
 
710  0 toggle public ArgInfo(Arg arg, String value, SubVals subVals, int argIndex)
711    {
712  0 this.arg = arg;
713  0 this.value = value;
714  0 this.subVals = subVals;
715  0 this.argIndex = argIndex;
716    }
717   
 
718  0 toggle public Arg arg()
719    {
720  0 return arg;
721    }
722   
 
723  0 toggle public String value()
724    {
725  0 return value;
726    }
727   
 
728  0 toggle public SubVals subVals()
729    {
730  0 return subVals;
731    }
732   
 
733  0 toggle public int argIndex()
734    {
735  0 return argIndex;
736    }
737   
 
738  0 toggle @Override
739    public int compareTo(ArgInfo ai2)
740    {
741  0 return Integer.compare(this.argIndex(), ai2.argIndex());
742    }
743    }
744   
 
745    public static enum Position
746    {
747    FIRST, BEFORE, AFTER
748    }
749    }