public static PersistentTransitionChoice<?> processOldAdd(LoadContext context, String first) throws PersistenceLayerException { int openParenLoc = first.indexOf('('); if (openParenLoc == -1) { Logging.errorPrint("Expected to have a ( : " + first); return null; } int closeParenLoc = first.lastIndexOf(')'); if (openParenLoc == -1) { Logging.errorPrint("Expected to have a ) : " + first); return null; } String key = first.substring(7, openParenLoc); String choices = first.substring(openParenLoc + 1, closeParenLoc); String count = ""; if (closeParenLoc != first.length() - 1) { count = first.substring(closeParenLoc + 1) + '|'; } PCClass applied = new PCClass(); ParseResult pr = context.processSubToken(applied, "ADD", key, count + choices); pr.printMessages(); if (!pr.passed()) { return null; } context.commit(); PersistentTransitionChoice<?> ptc = applied.getListFor(ListKey.ADD).get(0); return ptc; }
@Override protected ParseResult parseNonEmptyToken(LoadContext context, CDOMObject obj, String value) { int pipeLoc = value.indexOf(Constants.PIPE); if (pipeLoc == -1) { return new ParseResult.Fail(getTokenName() + " requires a SubToken"); } String key = value.substring(0, pipeLoc); return context.processSubToken(obj, getTokenName(), key, value.substring(pipeLoc + 1)); }