@Override public boolean applicableToSymbol(String symbol) { if (!symbol.contains("_")) return innerConverter.applicableToSymbol(symbol); String[] split = symbol.split("_"); if (split.length != 2 || split[1].length() == 0) return false; if (split[1].charAt(0) == '{') { if (split[1].length() < 3) return false; split[1] = split[1].substring(1, split[1].length() - 1); } try { Integer.parseInt(split[1]); return innerConverter.applicableToSymbol(split[0]); } catch (NumberFormatException e) { return false; } }
@Override public boolean applicableToSymbol(String symbol) { if (symbol.length() <= strokesString.length()) return false; if (!strokesString.equals(getStrokes(symbol))) return false; return converter.applicableToSymbol(getBase(symbol)); }
/** * Returns integer representation from specified string representation of single * index. * * @param index string representation of single index * @return integer representation of specified index * @throws IllegalArgumentException if rule for specified string */ public int getCode(String index) { try { for (IndexSymbolConverter converter : converters) if (converter.applicableToSymbol(index)) return (converter.getCode(index) & 0xFFFF) | ((converter.getType() & 0x7F) << 24); throw new IllegalArgumentException("No available converters for such symbol : " + index); } catch (IndexConverterException e) { throw new IllegalArgumentException("No available converters for such symbol : " + index); } } }