@Override public String getSymbol(int code, OutputFormat mode) throws IndexConverterException { return converter.getSymbol(code, mode) + strokesString; }
/** * Returns string representation from specified integer representation of single * index in the specified {@code outputFormat}. * * @param code integer representation of single index * @param outputFormat output format to be used to produce string representation * @return string representation of specified integer index * @throws IllegalArgumentException if rule for specified code */ public String getSymbol(int code, OutputFormat outputFormat) { byte typeId = (byte) ((code >>> 24) & 0x7F); int number = code & 0xFFFF; try { for (IndexSymbolConverter converter : converters) if (converter.getType() == typeId) { return converter.getSymbol(number, outputFormat);//symbol.length() == 1 ? symbol : symbol + " "; } throw new IllegalArgumentException("No appropriate converter for typeId 0x" + Integer.toHexString(typeId)); } catch (IndexConverterException e) { throw new IllegalArgumentException("Index 0x" + Integer.toHexString(code) + " conversion error"); } }
@Override public String getSymbol(int code, OutputFormat mode) throws IndexConverterException { int subscript = code / (innerConverter.maxNumberOfSymbols() + 1); if (subscript == 0) return innerConverter.getSymbol(code, mode); else { String symbol = innerConverter.getSymbol(code % (innerConverter.maxNumberOfSymbols() + 1), mode); if (mode.is(OutputFormat.WolframMathematica)) return "Subscript[" + symbol + ", " + subscript + "]"; if (mode.is(OutputFormat.Maple)) return symbol + subscript; return symbol + "_" + ("{" + subscript + "}"); } }