public void loadMathCharacterAliases(final String resourceLocation) { readResourceData(resourceLocation, new LineHandler() { @SuppressWarnings("synthetic-access") public void handleLine(String line) { line = line.replaceFirst("\\s+#.+$", ""); String[] fields = line.split("->"); /* aliasCommandName:targetCommandName */ String aliasCommandName = fields[0]; MathCharacter targetCharacter = ensureBuiltinMathCharacterCommand(fields[1], "Target command for alias"); addMathCharacterCommandAlias(aliasCommandName, targetCharacter); } }); }
public void loadMathCharacterBrackets(final String resourceLocation) { readResourceData(resourceLocation, new LineHandler() { @SuppressWarnings("synthetic-access") public void handleLine(String line) { /* Line is of the form inputCommandName:outputBracketCommandName:bracketType:(INFER|NOINFER) */ String[] fields = line.split(":"); String inputCommandName = fields[0]; String outputBracketCommandName = fields[1]; BracketType bracketType = BracketType.valueOf(fields[2]); boolean inferFences = "INFER".equals(fields[3]); MathCharacter inputMathCharacter = ensureBuiltinMathCharacterCommand(inputCommandName, "Bracket input command"); MathCharacter outputBracketMathCharacter = ensureBuiltinMathCharacterCommand(outputBracketCommandName, "Fence target"); inputMathCharacter.addInterpretation(new MathBracketInterpretation(outputBracketMathCharacter, bracketType, inferFences)); } }); }
public void loadMathCharacterDefinitions(final String resourceLocation) { readResourceData(resourceLocation, new LineHandler() { @SuppressWarnings("synthetic-access") public void handleLine(String line) { String[] fields = line.split(":"); /* codePointHex:commandName:type */ int codePoint = Integer.parseInt(fields[0], 16); String commandName = StringUtilities.nullIfEmpty(fields[1]); MathCharacterType mathCharacterType = MathCharacterType.valueOf(fields[2]); MathCharacter mathCharacter = new MathCharacter(codePoint, commandName, mathCharacterType); /* Define character input and (maybe) input command */ mathCharacterMap.put(Integer.valueOf(codePoint), mathCharacter); if (commandName!=null) { addMathCharacterCommand(mathCharacter); } } }); }
public void loadMathFunctionDefinitions(final String resourceLocation) { readResourceData(resourceLocation, new LineHandler() { public void handleLine(String line) { /* (Line is either functionName or laTexFunctionName->MathMLFunctionName) */ String latexName, outputName; int mapsToIndex = line.indexOf("->"); if (mapsToIndex!=-1) { latexName = line.substring(0, mapsToIndex); outputName = line.substring(mapsToIndex + 2); } else { latexName = line; outputName = line; } addSimpleMathCommand(latexName, new MathFunctionInterpretation(outputName)); } }); }
public void loadMathCharacterNegations(final String resourceLocation) { readResourceData(resourceLocation, new LineHandler() { @SuppressWarnings("synthetic-access") public void handleLine(String line) { /* Line is either of the form commandName or commandName->negatedCommandName. * * In the first case, the negatedCommandName is formed by prefixing the commandName * with 'n'. E.g. \leq -> \nleq. */ String sourceName, targetName; int mapsToIndex = line.indexOf("->"); if (mapsToIndex!=-1) { sourceName = line.substring(0, mapsToIndex); targetName = line.substring(mapsToIndex + 2); } else { sourceName = line; targetName = "n" + sourceName; } MathCharacter sourceCharacter = ensureBuiltinMathCharacterCommand(sourceName, "Source command for negation"); MathCharacter targetCharacter = ensureBuiltinMathCharacterCommand(targetName, "Target command for negation"); sourceCharacter.addInterpretation(new MathNegatableInterpretation(targetCharacter)); } }); }
public void loadMathCharacterBigLimitTargets(final String resourceLocation) { final MathBigLimitOwnerInterpretation bigLimitOwner = new MathBigLimitOwnerInterpretation(); readResourceData(resourceLocation, new LineHandler() { @SuppressWarnings("synthetic-access") public void handleLine(String line) { /* (Line is name of an existing command) */ MathCharacter target = ensureBuiltinMathCharacterCommand(line, "Target command for big limit owner"); target.addInterpretation(bigLimitOwner); } }); }