private void doElementEnd() { onElementEnd(); annotations.insert(1); ++currentLocation; currentContainer = currentContainer.getNextContainer(); currentParent = substrate.getParentElement(currentParent); }
void insert(RawAnnotationSet<Object> a, int firstShiftedIndex, int length) throws OperationException { a.begin(); if (firstShiftedIndex > 0) { a.skip(firstShiftedIndex); } if (length > 0) { a.insert(length); } a.finish(); }
void insert(RawAnnotationSet<Object> a, int firstShiftedIndex, int length) throws OperationException { a.begin(); if (firstShiftedIndex > 0) { a.skip(firstShiftedIndex); } if (length > 0) { a.insert(length); } a.finish(); }
private void doElementStart(String tagName, Attributes attributes) { splitCurrent(); E newElement = substrate.createElement(tagName, attributes, currentParent, currentContainer.getValue()); insertBefore(currentContainer, newElement, 1); currentContainer.insertBefore(null, 1); annotations.insert(1); currentContainer = currentContainer.getPreviousContainer(); currentParent = newElement; ++currentLocation; onElementStart(newElement); }
void insert(RawAnnotationSet<Object> a, int firstShiftedIndex, int length) throws OperationException { a.begin(); if (firstShiftedIndex > 0) { a.skip(firstShiftedIndex); } if (length > 0) { a.insert(length); } a.finish(); }
void insert(RawAnnotationSet<Object> a, int firstShiftedIndex, int length) throws OperationException { a.begin(); if (firstShiftedIndex > 0) { a.skip(firstShiftedIndex); } if (length > 0) { a.insert(length); } a.finish(); }
@SuppressWarnings("unchecked") public void testListenerForInsertion() throws OperationException { final AnnotationSetListener<Object> listener = mock(AnnotationSetListener.class); RawAnnotationSet<Object> m = getNewSet(listener); m.begin(); m.startAnnotation("a", "1"); m.insert(1); m.endAnnotation("a"); m.finish(); verify(listener).onAnnotationChange(0, 1, "a", "1"); m.begin(); m.skip(1); m.insert(1); m.finish(); }
@SuppressWarnings("unchecked") public void testListenerForInsertion() throws OperationException { final AnnotationSetListener<Object> listener = mock(AnnotationSetListener.class); RawAnnotationSet<Object> m = getNewSet(listener); m.begin(); m.startAnnotation("a", "1"); m.insert(1); m.endAnnotation("a"); m.finish(); verify(listener).onAnnotationChange(0, 1, "a", "1"); m.begin(); m.skip(1); m.insert(1); m.finish(); }
public void testCreateWithFinalAnnotation() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.insert(5); m.startAnnotation("a", "1"); m.insert(10); m.endAnnotation("a"); m.finish(); assertEquals(5, m.firstAnnotationChange(5, 15, "a", null)); assertEquals(15, m.lastAnnotationChange(5, 15, "a", null)); assertEquals(5, m.firstAnnotationChange(0, 15, "a", null)); assertEquals(15, m.lastAnnotationChange(0, 15, "a", null)); assertEquals(-1, m.firstAnnotationChange(5, 15, "a", "1")); assertEquals(-1, m.lastAnnotationChange(5, 15, "a", "1")); }
public void testCreateWithInitialAnnotation() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.startAnnotation("a", "1"); m.insert(10); m.endAnnotation("a"); m.insert(5); m.finish(); assertEquals(0, m.firstAnnotationChange(0, 10, "a", null)); assertEquals(10, m.lastAnnotationChange(0, 10, "a", null)); assertEquals(0, m.firstAnnotationChange(0, 15, "a", null)); assertEquals(10, m.lastAnnotationChange(0, 15, "a", null)); assertEquals(-1, m.firstAnnotationChange(0, 10, "a", "1")); assertEquals(-1, m.lastAnnotationChange(0, 10, "a", "1")); }
public void testCreateWithFinalAnnotation() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.insert(5); m.startAnnotation("a", "1"); m.insert(10); m.endAnnotation("a"); m.finish(); assertEquals(5, m.firstAnnotationChange(5, 15, "a", null)); assertEquals(15, m.lastAnnotationChange(5, 15, "a", null)); assertEquals(5, m.firstAnnotationChange(0, 15, "a", null)); assertEquals(15, m.lastAnnotationChange(0, 15, "a", null)); assertEquals(-1, m.firstAnnotationChange(5, 15, "a", "1")); assertEquals(-1, m.lastAnnotationChange(5, 15, "a", "1")); }
public void testCreateWithInitialAnnotation() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.startAnnotation("a", "1"); m.insert(10); m.endAnnotation("a"); m.insert(5); m.finish(); assertEquals(0, m.firstAnnotationChange(0, 10, "a", null)); assertEquals(10, m.lastAnnotationChange(0, 10, "a", null)); assertEquals(0, m.firstAnnotationChange(0, 15, "a", null)); assertEquals(10, m.lastAnnotationChange(0, 15, "a", null)); assertEquals(-1, m.firstAnnotationChange(0, 10, "a", "1")); assertEquals(-1, m.lastAnnotationChange(0, 10, "a", "1")); }
public void testBlank() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.insert(7); m.finish(); assertEquals(-1, m.firstAnnotationChange(0, 7, "hi", null)); assertEquals(-1, m.lastAnnotationChange(0, 7, "hi", null)); assertEquals(-1, m.firstAnnotationChange(1, 6, "hi", null)); assertEquals(-1, m.lastAnnotationChange(1, 6, "hi", null)); }
public void testBlank() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.insert(7); m.finish(); assertEquals(-1, m.firstAnnotationChange(0, 7, "hi", null)); assertEquals(-1, m.lastAnnotationChange(0, 7, "hi", null)); assertEquals(-1, m.firstAnnotationChange(1, 6, "hi", null)); assertEquals(-1, m.lastAnnotationChange(1, 6, "hi", null)); }
public void testCreateWithSpanningAnnotation() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.startAnnotation("a", "1"); m.insert(10); m.endAnnotation("a"); m.finish(); assertEquals(0, m.firstAnnotationChange(0, 10, "a", null)); assertEquals(10, m.lastAnnotationChange(0, 10, "a", null)); assertEquals(-1, m.firstAnnotationChange(0, 10, "a", "1")); assertEquals(-1, m.lastAnnotationChange(0, 10, "a", "1")); }
public void testCreateWithSpanningAnnotation() { RawAnnotationSet<Object> m = getNew(); m.begin(); m.startAnnotation("a", "1"); m.insert(10); m.endAnnotation("a"); m.finish(); assertEquals(0, m.firstAnnotationChange(0, 10, "a", null)); assertEquals(10, m.lastAnnotationChange(0, 10, "a", null)); assertEquals(-1, m.firstAnnotationChange(0, 10, "a", "1")); assertEquals(-1, m.lastAnnotationChange(0, 10, "a", "1")); }