X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2Fargparser%2FArgValue.java;h=f76b7570cc07e65ca453b0aa1f5ae5557284d4bd;hb=d8fcaf315395d614059f4345c20ff2f86a4476f1;hp=1643713b5d6bbed6ad091cf0508cfed27a6abb4d;hpb=79456f40b33e73e2fb5420a3287ae80854281ef6;p=jalview.git diff --git a/src/jalview/bin/argparser/ArgValue.java b/src/jalview/bin/argparser/ArgValue.java index 1643713..f76b757 100644 --- a/src/jalview/bin/argparser/ArgValue.java +++ b/src/jalview/bin/argparser/ArgValue.java @@ -1,5 +1,8 @@ package jalview.bin.argparser; +import jalview.bin.argparser.Arg.Opt; +import jalview.bin.argparser.Arg.Type; + /** * A helper class to keep an index of argument position with argument values */ @@ -11,26 +14,45 @@ public class ArgValue implements Comparable private String value; + /* + * Type type is only really used by --help-type + */ + private Type type = null; + // This id is set by a subVal id= to identify the product of this ArgValue // later. Set but not currently used. private String id; private SubVals subVals; - protected ArgValue(Arg a, SubVals sv, String content, int argIndex) + protected ArgValue(Arg a, SubVals sv, Type type, String content, + int argIndex) { this.arg = a; this.value = content; this.argIndex = argIndex; this.subVals = sv == null ? new SubVals("") : sv; + this.setType(type); } - protected ArgValue(Arg a, String value, int argIndex) + protected ArgValue(Arg a, Type type, String value, int argIndex) { this.arg = a; this.argIndex = argIndex; this.subVals = new SubVals(value); this.value = getSubVals().getContent(); + this.setType(type); + } + + protected void setType(Type t) + { + if (this.getArg().hasOption(Opt.HASTYPE)) + this.type = t; + } + + public Type getType() + { + return type; } public Arg getArg() @@ -76,7 +98,7 @@ public class ArgValue implements Comparable } @Override - public int compareTo(ArgValue o) + public final int compareTo(ArgValue o) { return this.getArgIndex() - o.getArgIndex(); }