+ // default to merge subvals if subvals are provided
+ argValueOperation(op, linkedId, type, avs, sv, true, v, b, argIndex,
+ doSubs);
+ }
+
+ /**
+ * The following operations look for the "*" and "open*" linkedIds and add the
+ * argvalue to all appropriate linkedId ArgValues if it does. If subvals are
+ * supplied, they are inserted into all new set values.
+ *
+ * @param op
+ * The ArgParser.Op operation
+ * @param linkedId
+ * The String linkedId from the ArgValuesMap
+ * @param type
+ * The Arg.Type to attach to this ArgValue
+ * @param avs
+ * The ArgValues for this linkedId
+ * @param sv
+ * Use these SubVals on the ArgValue
+ * @param merge
+ * Merge the SubVals with any existing on the value. False will
+ * replace unless sv is null
+ * @param v
+ * The value of the ArgValue (may contain subvals).
+ * @param b
+ * The boolean value of the ArgValue.
+ * @param argIndex
+ * The argIndex for the ArgValue.
+ * @param doSubs
+ * Whether to perform substitutions on the subvals and value.
+ */
+ private void argValueOperation(Op op, String linkedId, Type type,
+ ArgValues avs, SubVals sv, boolean merge, String v, boolean b,
+ int argIndex, boolean doSubs)
+ {
+ Arg a = avs.arg();
+
+ List<String> wildcardLinkedIds = null;
+ if (a.hasOption(Opt.ALLOWMULTIID))
+ {
+ switch (linkedId)
+ {
+ case MATCHALLLINKEDIDS:
+ wildcardLinkedIds = getLinkedIds();
+ break;
+ case MATCHOPENEDLINKEDIDS:
+ wildcardLinkedIds = this.storedLinkedIds;
+ break;
+ }
+ }
+
+ // if we're not a wildcard linkedId and the arg is marked to be stored, add
+ // to storedLinkedIds
+ if (linkedId != null && wildcardLinkedIds == null
+ && a.hasOption(Opt.STORED)
+ && !storedLinkedIds.contains(linkedId))
+ {
+ storedLinkedIds.add(linkedId);
+ }
+
+ // if we are a wildcard linkedId, apply the arg and value to all appropriate
+ // linkedIds
+ if (wildcardLinkedIds != null)
+ {
+ for (String id : wildcardLinkedIds)
+ {
+ // skip incorrectly stored wildcard ids!
+ if (id == null || MATCHALLLINKEDIDS.equals(id)
+ || MATCHOPENEDLINKEDIDS.equals(id))
+ {
+ continue;
+ }
+ ArgValuesMap avm = linkedArgs.get(id);
+ // don't set an output if there isn't an input
+ if (a.hasOption(Opt.REQUIREINPUT)
+ && !avm.hasArgWithOption(Opt.INPUT))
+ continue;
+
+ ArgValues tavs = avm.getOrCreateArgValues(a);
+ switch (op)
+ {
+
+ case ADDVALUE:
+ String val = v;
+ if (sv != null)
+ {
+ if (doSubs)
+ {
+ sv = new SubVals(sv, val, merge);
+ val = makeSubstitutions(sv.getContent(), id);
+ }
+ tavs.addValue(sv, type, val, argIndex, true);
+ }
+ else
+ {
+ if (doSubs)
+ {
+ val = makeSubstitutions(v, id);
+ }
+ tavs.addValue(type, val, argIndex, true);
+ }
+ finaliseStoringArgValue(id, tavs);
+ break;
+
+ case SETBOOLEAN:
+ tavs.setBoolean(type, b, argIndex, true);
+ finaliseStoringArgValue(id, tavs);
+ break;
+
+ case SETNEGATED:
+ tavs.setNegated(b, true);
+ break;
+
+ case INCREMENTCOUNT:
+ tavs.incrementCount();
+ break;
+
+ default:
+ break;
+
+ }
+
+ }
+ }
+ else // no wildcard linkedId -- do it simpler