public void testEndBeforeAndStartAfterDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", null); b.skip(1); b.endAnnotation("a"); b.deleteCharacters(1); b.startAnnotation("a", "1"); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testChangeBetweenInsertionAndDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.startAnnotation("a", "2"); b.deleteCharacters(1); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testOpenClose() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.startAnnotation("b", "2"); b.startAnnotation("c", "3"); b.endAnnotation("a"); b.endAnnotation("c"); b.endAnnotation("b"); checkApply(doc, b.build()); }
public void testEndBeforeAndStartAfterDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", null); b.skip(1); b.endAnnotation("a"); b.deleteCharacters(1); b.startAnnotation("a", "1"); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testChangeBetweenInsertionAndDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.startAnnotation("a", "2"); b.deleteCharacters(1); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
@SuppressWarnings("rawtypes") Nindo generate() { while (true) { this.a = new NindoAutomaton(schemaConstraints, doc); Nindo.Builder b = new Nindo.Builder(); targetDoc = b; boolean ok = generate1(); if (ok) { return b.build(); } } }
public void testBug1() throws OperationException { IndexedDocumentImpl<Node, Element, Text, ?> d = nindoDocumentParser.parseDocument( "<a>a</a>"); Nindo.Builder b = new Nindo.Builder(); b.skip(1); b.deleteCharacters(1); checkApply(d, b.build()); }
private Builder at(int location) { Builder b = new Builder(); if (location > 0) { b.skip(location); } return b; } }
private static Nindo createDeletion(int... deletionBoundaries) { Nindo.Builder builder = new Nindo.Builder(); int location = 0; for (int i = 0; i < deletionBoundaries.length; i += 2) { builder.skip(deletionBoundaries[i] - location); int deletionSize = deletionBoundaries[i+1] - deletionBoundaries[i]; builder.deleteCharacters(deletionSize); location = deletionBoundaries[i+1]; } return builder.build(); }
public void testOpenClose() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.startAnnotation("b", "2"); b.startAnnotation("c", "3"); b.endAnnotation("a"); b.endAnnotation("c"); b.endAnnotation("b"); checkApply(doc, b.build()); }
public void testEndBeforeAndStartAfterDeletionThenInsertion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", null); b.skip(1); b.endAnnotation("a"); b.deleteCharacters(1); b.startAnnotation("a", "1"); b.characters("x"); b.endAnnotation("a"); checkApply(doc, b.build()); }
private Builder at(int location) { Builder b = new Builder(); if (location > 0) { b.skip(location); } return b; }
public void testBug1() throws OperationException { IndexedDocumentImpl<Node, Element, Text, ?> d = nindoDocumentParser.parseDocument( "<a>a</a>"); Nindo.Builder b = new Nindo.Builder(); b.skip(1); b.deleteCharacters(1); checkApply(d, b.build()); }
public void testDeletionResets() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefghijkl"); Nindo.Builder b; b = new Nindo.Builder(); b.startAnnotation("a", "1"); b.skip(3); b.deleteCharacters(3); b.skip(3); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testOpenInsertOpenClose() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("xyz"); b.startAnnotation("a", "1"); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testOpenInsertOpenClose() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("xyz"); b.startAnnotation("a", "1"); b.endAnnotation("a"); checkApply(doc, b.build()); }
private static Nindo createDeletion(int... deletionBoundaries) { Nindo.Builder builder = new Nindo.Builder(); int location = 0; for (int i = 0; i < deletionBoundaries.length; i += 2) { builder.skip(deletionBoundaries[i] - location); int deletionSize = deletionBoundaries[i+1] - deletionBoundaries[i]; builder.deleteCharacters(deletionSize); location = deletionBoundaries[i+1]; } return builder.build(); }
/** * Creates a new nindo builder. */ public static Builder builder() { return new Builder(); }
public void testDeletionResets() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefghijkl"); Nindo.Builder b; b = new Nindo.Builder(); b.startAnnotation("a", "1"); b.skip(3); b.deleteCharacters(3); b.skip(3); b.endAnnotation("a"); checkApply(doc, b.build()); }
private Builder at(int location) { Builder b = new Builder(); if (location > 0) { b.skip(location); } return b; } }