private static final String NEGATESTRING = "no";
- // the linked id used for no id (not even square braces)
- private static final String DEFAULTLINKEDID = "";
+ // the default linked id prefix used for no id (not even square braces)
+ private static final String DEFAULTLINKEDIDPREFIX = "JALVIEW:";
+
+ // the counter added to the default linked id prefix
+ private int defaultLinkedIdCounter = 0;
// the linked id used to increment the idCounter (and use the incremented
// value)
private int idCounter = 0;
+ // flag to say whether {n} subtitutions in output filenames should be made.
+ // Turn on and off with --subs and --nosubs
+ private boolean substitutions = false;
+
private static enum Opt
{
BOOLEAN, STRING, UNARY, MULTI, LINKED, NODUPLICATEVALUES, BOOTSTRAP,
- GLOB
+ GLOB, NOACTION
}
public enum Arg
VSESS, OUTPUT, OUTPUTTYPE, SSANNOTATION, NOTEMPFAC, TEMPFAC,
TEMPFAC_LABEL, TEMPFAC_DESC, TEMPFAC_SHADING, TITLE, PAEMATRIX, WRAP,
NOSTRUCTURE, STRUCTURE, IMAGE, QUIT, CLOSE, DEBUG("d"), QUIET("q"),
- ARGFILE;
+ ARGFILE, INCREMENT, NPP("n++"), SUBSTITUTIONS, NIL;
static
{
DEBUG.setOptions(Opt.BOOLEAN, Opt.BOOTSTRAP);
QUIET.setOptions(Opt.UNARY, Opt.MULTI, Opt.BOOTSTRAP);
ARGFILE.setOptions(Opt.STRING, Opt.MULTI, Opt.BOOTSTRAP, Opt.GLOB);
+ INCREMENT.setOptions(Opt.UNARY, Opt.MULTI, Opt.NOACTION);
+ NPP.setOptions(Opt.UNARY, Opt.MULTI, Opt.NOACTION);
+ SUBSTITUTIONS.setOptions(Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION);
+ NIL.setOptions(Opt.UNARY, Opt.LINKED, Opt.MULTI, Opt.NOACTION);
// BOOTSTRAP args are parsed before a full parse of arguments and
// so are accessible at an earlier stage to (e.g.) set debug log level,
// provide a props file (that might set log level), run headlessly, read
// an argfile instead of other args.
-
}
private final String[] argNames;
}
}
+ // make NOACTION adjustments
+ // default and auto counter increments
+ if (a == Arg.INCREMENT)
+ {
+ defaultLinkedIdCounter++;
+ }
+ else if (a == Arg.NPP)
+ {
+ idCounter++;
+ }
+ else if (a == Arg.SUBSTITUTIONS)
+ {
+ substitutions = !negated;
+ }
+
String autoCounterString = null;
+ boolean usingAutoCounterLinkedId = false;
+ String defaultLinkedId = new StringBuilder(DEFAULTLINKEDIDPREFIX)
+ .append(Integer.toString(defaultLinkedIdCounter))
+ .toString();
+ boolean usingDefaultLinkedId = false;
if (a.hasOption(Opt.LINKED))
{
if (linkedId == null)
{
// use default linkedId for linked arguments
- linkedId = DEFAULTLINKEDID;
+ linkedId = defaultLinkedId;
+ usingDefaultLinkedId = true;
Console.debug(
"Changing linkedId to '" + linkedId + "' from " + arg);
}
// turn {n} to the autoCounter
autoCounterString = Integer.toString(idCounter);
linkedId = autoCounterString;
+ usingAutoCounterLinkedId = true;
Console.debug(
"Changing linkedId to '" + linkedId + "' from " + arg);
}
// turn {++n} to the incremented autoCounter
autoCounterString = Integer.toString(++idCounter);
linkedId = autoCounterString;
+ usingAutoCounterLinkedId = true;
Console.debug(
"Changing linkedId to '" + linkedId + "' from " + arg);
}
if (!linkedArgs.containsKey(linkedId))
linkedArgs.put(linkedId, new ArgValuesMap());
+ // do not continue for NOACTION args
+ if (a.hasOption(Opt.NOACTION))
+ continue;
+
ArgValuesMap avm = linkedArgs.get(linkedId);
// not dealing with both NODUPLICATEVALUES and GLOB
{
// allow a default linked id for single usage
if (linkedId == null)
- linkedId = DEFAULTLINKEDID;
+ linkedId = defaultLinkedId;
// store the order of linkedIds
if (linkedOrder == null)
linkedOrder = new ArrayList<>();