SnomedRequestCallback implements RequestCallback { static String nextMappingGroup(final String mappingGroup) { if (mappingGroup == null || "".equals(mappingGroup)) return "A"; final char[] cs = mappingGroup.toCharArray(); boolean incrementFurther = true; for (int i = cs.length - 1; i >= 0; i--) { if (!incrementFurther) break; if (++cs[i] > 'Z') cs[i] = 'A'; else incrementFurther = false; } final String result = new String(cs); if (incrementFurther) return result + "A"; else return result; } SnomedRequestCallback(final List<SnomedConcept> conceptList, final Label statusLabel,
                                 final GlassLoadingPanel glassPanel, final Map<String, String> typeCodeToDescription); void onError(final Request request, final Throwable e); void onResponseReceived(final Request request, final Response response);  }
@Test public void testNextMappingGroup() throws Exception { assertEquals(SnomedRequestCallback.nextMappingGroup(null), "A"); assertEquals(SnomedRequestCallback.nextMappingGroup(""), "A"); assertEquals(SnomedRequestCallback.nextMappingGroup("A"), "B"); assertEquals(SnomedRequestCallback.nextMappingGroup("B"), "C"); assertEquals(SnomedRequestCallback.nextMappingGroup("Z"), "AA"); assertEquals(SnomedRequestCallback.nextMappingGroup("AA"), "AB"); assertEquals(SnomedRequestCallback.nextMappingGroup("AC"), "AD"); assertEquals(SnomedRequestCallback.nextMappingGroup("AZ"), "BA"); assertEquals(SnomedRequestCallback.nextMappingGroup("BA"), "BB"); assertEquals(SnomedRequestCallback.nextMappingGroup("ZZ"), "AAA"); assertEquals(SnomedRequestCallback.nextMappingGroup("AAA"), "AAB"); assertEquals(SnomedRequestCallback.nextMappingGroup("AZA"), "AZB"); assertEquals(SnomedRequestCallback.nextMappingGroup("AZZ"), "BAA"); assertEquals(SnomedRequestCallback.nextMappingGroup("ZZZ"), "AAAA"); assertEquals(SnomedRequestCallback.nextMappingGroup("ABZZ"), "ACAA"); }