/**
* A helper class to keep an index of argument position with argument values
*/
-public class ArgValue
+public class ArgValue implements Comparable<ArgValue>
{
+ private Arg arg;
+
private int argIndex;
private String value;
private String id;
- private SubVals subVals = null;
+ private SubVals subVals;
+
+ protected ArgValue(Arg a, SubVals sv, String content, int argIndex)
+ {
+ this.arg = a;
+ this.value = content;
+ this.argIndex = argIndex;
+ this.subVals = sv == null ? new SubVals("") : sv;
+ }
- protected ArgValue(String value, int argIndex)
+ protected ArgValue(Arg a, String value, int argIndex)
{
- this.value = value;
+ this.arg = a;
this.argIndex = argIndex;
- this.subVals = ArgParser.getSubVals(getValue());
+ this.subVals = new SubVals(value);
+ this.value = getSubVals().getContent();
+ }
+
+ public Arg getArg()
+ {
+ return arg;
}
public String getValue()
{
this.subVals.put(key, val);
}
+
+ @Override
+ public int compareTo(ArgValue o)
+ {
+ return this.getArgIndex() - o.getArgIndex();
+ }
}
\ No newline at end of file