private Set<Opt> argsOptions = new HashSet<>();
+ private Set<Type> argsTypes = new HashSet<>();
+
public static BootstrapArgs getBootstrapArgs(String[] args)
{
List<String> argList = new ArrayList<>(Arrays.asList(args));
argsOptions.add(opt);
}
}
+ Type t = a.getType();
+ if (!argsTypes.contains(t))
+ {
+ argsTypes.add(t);
+ }
}
if (a == null || !a.hasOption(Opt.BOOTSTRAP))
* Retrieves the first value even if MULTI.
* A convenience for non-MULTI args.
*/
- public String get(Arg a)
+ public String getValue(Arg a)
{
if (!bootstrapArgMap.containsKey(a))
return null;
{
if (!bootstrapArgMap.containsKey(a))
return d;
- return Boolean.parseBoolean(get(a));
+ return Boolean.parseBoolean(getValue(a));
}
public boolean getBoolean(Arg a)
}
if (bootstrapArgMap.containsKey(a))
{
- return Boolean.parseBoolean(get(a));
+ return Boolean.parseBoolean(getValue(a));
}
else
{
{
return argsOptions.contains(opt);
}
+
+ public boolean argsHaveType(Type type)
+ {
+ return argsTypes.contains(type);
+ }
+
+ public boolean isHeadless()
+ {
+ boolean isHeadless = false;
+ if (this.argsHaveType(Type.HELP))
+ {
+ // --help, --help-all, ... specified => headless
+ isHeadless = true;
+ }
+ else if (this.contains(Arg.VERSION))
+ {
+ // --version specified => headless
+ isHeadless = true;
+ }
+ else if (this.contains(Arg.GUI))
+ {
+ // --gui specified => forced NOT headless
+ isHeadless = !this.getBoolean(Arg.GUI);
+ }
+ else if (this.contains(Arg.HEADLESS))
+ {
+ // --headless, --noheadless specified => use value
+ isHeadless = this.getBoolean(Arg.HEADLESS);
+ }
+ else if (this.argsHaveOption(Opt.OUTPUTFILE))
+ {
+ // --output file.fa, --image pic.png, --structureimage struct.png =>
+ // assume headless unless above has been already specified
+ isHeadless = true;
+ }
+ return isHeadless;
+ }
}