@After public void after() { System.out.println(" 1 | 2 | 3 | 4 | 5"); System.out.println(" 012345678901234567890123456789012345678901234567890"); System.out.println("Base : " + baseString); System.out.println("Bottom : " + bottom.get() + " - " + bottom.dataSegmentsToString()); System.out.println("Top : " + top.get() + " - " + top.dataSegmentsToString()); }
@Test public void testInsert2() { // 0123456789012345678901234567890 baseString = "This is a hyphen- ated sentence"; bottom = new AlignedString(baseString); top = new AlignedString(bottom); System.out.println("Delete word fragment"); final String fragment = top.get(18, 22); top.delete(18, 22); System.out.println("Top : " + top.get() + " - " + top.dataSegmentsToString()); System.out.println("Bottom : " + bottom.get() + " - " + bottom.dataSegmentsToString()); System.out.println("Insert word fragment to complete word"); top.insert(16, fragment); System.out.println("Top : " + top.get() + " - " + top.dataSegmentsToString()); System.out.println("Bottom : " + bottom.get() + " - " + bottom.dataSegmentsToString()); System.out.println("Delete hyphen"); top.delete(16 + fragment.length(), 18 + fragment.length()); System.out.println("Top : " + top.get() + " - " + top.dataSegmentsToString()); System.out.println("Bottom : " + bottom.get() + " - " + bottom.dataSegmentsToString()); ImmutableInterval uli = new ImmutableInterval(0, 18); ImmutableInterval adi = top.inverseResolve(uli); System.out.println("ADI : " + top.get(adi.getStart(), adi.getEnd())); System.out.println("ULI : " + bottom.get(uli.getStart(), uli.getEnd())); assertEquals("This is a hyphenated", top.get(adi.getStart(), adi.getEnd())); uli = new ImmutableInterval(18, 31); adi = top.inverseResolve(uli); System.out.println("ADI : " + top.get(adi.getStart(), adi.getEnd())); System.out.println("ULI : " + bottom.get(uli.getStart(), uli.getEnd())); assertEquals(" sentence", top.get(adi.getStart(), adi.getEnd())); }