Merge branch 'develop' into spike/JAL-4047/JAL-4048_columns_in_sequenceID
[jalview.git] / src / jalview / bin / argparser / ArgValues.java
index f2c299c..f25fc9a 100644 (file)
@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
 
 import jalview.bin.Console;
 import jalview.bin.argparser.Arg.Opt;
+import jalview.bin.argparser.Arg.Type;
 
 public class ArgValues
 {
@@ -31,6 +32,11 @@ public class ArgValues
 
   private Map<String, ArgValue> idMap = new HashMap<>();
 
+  /*
+   * Type type is only really used by --help-type
+   */
+  private Type type = null;
+
   protected ArgValues(Arg a)
   {
     this.arg = a;
@@ -53,6 +59,17 @@ public class ArgValues
     return arg;
   }
 
+  protected void setType(Type t)
+  {
+    if (this.arg().hasOption(Opt.HASTYPE))
+      this.type = t;
+  }
+
+  public Type getType()
+  {
+    return type;
+  }
+
   protected int getCount()
   {
     return argCount;
@@ -76,8 +93,10 @@ public class ArgValues
     return this.negated;
   }
 
-  protected void setBoolean(boolean b, int i, boolean beingSetByWildcard)
+  protected void setBoolean(Type t, boolean b, int i,
+          boolean beingSetByWildcard)
   {
+    this.setType(t);
     // don't overwrite a wildcard set boolean with a non-wildcard set boolean
     if (boolIndex >= 0 && !this.setByWildcard && beingSetByWildcard)
       return;
@@ -117,15 +136,16 @@ public class ArgValues
     return sb.toString();
   }
 
-  protected void addValue(String val, int argIndex, boolean wildcard)
+  protected void addValue(Type type, String val, int argIndex,
+          boolean wildcard)
   {
-    addArgValue(new ArgValue(arg(), val, argIndex), wildcard);
+    addArgValue(new ArgValue(arg(), type, val, argIndex), wildcard);
   }
 
-  protected void addValue(SubVals sv, String content, int argIndex,
-          boolean wildcard)
+  protected void addValue(SubVals sv, Type type, String content,
+          int argIndex, boolean wildcard)
   {
-    addArgValue(new ArgValue(arg(), sv, content, argIndex), wildcard);
+    addArgValue(new ArgValue(arg(), sv, type, content, argIndex), wildcard);
   }
 
   protected void addArgValue(ArgValue av, boolean beingSetByWildcard)