EdictEntry extends DictEntry { static int[] findSenseNumber(String str) { final StringTokens braces = new StringTokens(str, "()", true); boolean inBrace = false; while (braces.hasMoreTokens()) { final String t = braces.nextToken(); final String token = t.trim(); if (token.startsWith("(")) { inBrace = true; continue; } if (token.startsWith(")")) { inBrace = false; continue; } if (inBrace) { try { return new int[]{Integer.parseInt(token), braces.getCurrentPosition() + 1}; } catch (NumberFormatException e) { continue; } } } return null; } EdictEntry(final String kanji, final String reading, final String english, final boolean isCommon);  EdictEntry(final String kanji, final String reading, final String english); static EdictEntry fromEntry(final DictEntry entry); boolean isIchidan(); boolean isGodan(); boolean isVerb(); boolean isSuru(); boolean isKuru(); List<String> getMarkings(); List<String> getMarkings(final String str); List<List<String>> getSenses();  }
@Test public void testFindSenseNumber() { assertNull(EdictEntry.findSenseNumber("foo")); assertEquals(4, EdictEntry.findSenseNumber("foo (4) kraa")[0]); assertEquals(7, EdictEntry.findSenseNumber("foo (4) kraa")[1]); assertNull(EdictEntry.findSenseNumber("foo (4a) kraa")); assertEquals(3, EdictEntry.findSenseNumber("(3)")[0]); assertEquals(3, EdictEntry.findSenseNumber("(3)")[1]); }