Package org.waveprotocol.wave.model.document.operation.impl

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder


    // A's annotation spatially adjacent to and before B's deletion
    new ReversibleTestParameters(
        DocOpCreator.setAnnotation(20, 4, 6, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 6, "abc"),
        DocOpCreator.setAnnotation(17, 4, 6, "hello", null, "world"),
        new DocOpBuilder()
            .retain(6)
            .annotationBoundary(beginAnnotation("hello", null, "world"))
            .deleteCharacters("abc")
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build()
    ).run();
    // A's annotation spatially adjacent to and after B's deletion
    new ReversibleTestParameters(
        DocOpCreator.setAnnotation(20, 4, 6, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 1, "abc"),
        DocOpCreator.setAnnotation(17, 1, 3, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 1, "abc")
    ).run();
    // A's annotation overlaps B's deletion
    new ReversibleTestParameters(
        DocOpCreator.setAnnotation(20, 4, 6, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 1, "abcd"),
        DocOpCreator.setAnnotation(16, 1, 2, "hello", null, "world"),
        new DocOpBuilder()
            .retain(1)
            .deleteCharacters("abc")
            .annotationBoundary(beginAnnotation("hello", "world", null))
            .deleteCharacters("d")
            .annotationBoundary(finishAnnotation("hello"))
            .retain(15)
            .build()
    ).run();
    // A's annotation overlaps B's deletion
    new ReversibleTestParameters(
        DocOpCreator.setAnnotation(20, 4, 6, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 5, "abcd"),
        DocOpCreator.setAnnotation(16, 4, 5, "hello", null, "world"),
        new DocOpBuilder()
            .retain(5)
            .deleteCharacters("a")
            .annotationBoundary(beginAnnotation("hello", null, "world"))
            .deleteCharacters("bcd")
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build()
    ).run();
    // A's annotation encloses B's deletion
    new ReversibleTestParameters(
        DocOpCreator.setAnnotation(20, 2, 8, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 5, "ab"),
        DocOpCreator.setAnnotation(18, 2, 6, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 5, "ab")
    ).run();
    // A's annotation inside B's deletion
    new ReversibleTestParameters(
        DocOpCreator.setAnnotation(20, 5, 7, "hello", null, "world"),
        DocOpCreator.deleteCharacters(20, 2, "abcdef"),
        DocOpCreator.identity(14),
        new DocOpBuilder()
            .retain(2)
            .deleteCharacters("abc")
            .annotationBoundary(beginAnnotation("hello", "world", null))
            .deleteCharacters("de")
            .annotationBoundary(finishAnnotation("hello"))
            .deleteCharacters("f")
            .retain(12)
            .build()
    ).run();
    // A's operation clears an annotation
    new ReversibleTestParameters(
        DocOpCreator.setAnnotation(20, 4, 6, "hello", "world", null),
        DocOpCreator.deleteCharacters(20, 6, "abc"),
        DocOpCreator.setAnnotation(17, 4, 6, "hello", "world", null),
        new DocOpBuilder()
            .retain(6)
            .annotationBoundary(beginAnnotation("hello", "world", null))
            .deleteCharacters("abc")
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
View Full Code Here


    ).run();
    // client's annotation overlaps server's annotation
    new TestParameters(
        DocOpCreator.setAnnotation(20, 2, 6, "hello", "initial", "world"),
        DocOpCreator.setAnnotation(20, 5, 9, "hello", "initial", "there"),
        new DocOpBuilder()
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(3)
            .annotationBoundary(beginAnnotation("hello", "there", "world"))
            .retain(1)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(14)
            .build(),
        DocOpCreator.setAnnotation(20, 6, 9, "hello", "initial""there")
    ).run();
    // client's annotation overlaps server's annotation
    new TestParameters(
        DocOpCreator.setAnnotation(20, 5, 9, "hello", "initial", "world"),
        DocOpCreator.setAnnotation(20, 2, 6, "hello", "initial", "there"),
        new DocOpBuilder()
            .retain(5)
            .annotationBoundary(beginAnnotation("hello", "there", "world"))
            .retain(1)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(3)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build(),
        DocOpCreator.setAnnotation(20, 2, 5, "hello", "initial", "there")
    ).run();
    // client's annotation encloses server's annotation
    new TestParameters(
        DocOpCreator.setAnnotation(20, 2, 9, "hello", "initial", "world"),
        DocOpCreator.setAnnotation(20, 5, 7, "hello", "initial", "there"),
        new DocOpBuilder()
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(3)
            .annotationBoundary(beginAnnotation("hello", "there", "world"))
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(2)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build(),
        DocOpCreator.identity(20)
    ).run();
    // client's annotation inside server's annotation
    new TestParameters(
        DocOpCreator.setAnnotation(20, 5, 7, "hello", "initial", "world"),
        DocOpCreator.setAnnotation(20, 2, 9, "hello", "initial", "there"),
        DocOpCreator.setAnnotation(20, 5, 7, "hello", "there", "world"),
        new DocOpBuilder()
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "there"))
            .retain(3)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "there"))
            .retain(2)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build()
    ).run();
    // client's annotation overlaps server's incontiguous annotation
    new TestParameters(
        DocOpCreator.setAnnotation(20, 4, 8, "hello", "initial", "world"),
        new DocOpBuilder()
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "there"))
            .retain(3)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "there"))
            .retain(2)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build(),
        new DocOpBuilder()
            .retain(4)
            .annotationBoundary(beginAnnotation("hello", "there", "world"))
            .retain(1)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "there", "world"))
            .retain(1)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(12)
            .build(),
        new DocOpBuilder()
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "there"))
            .retain(2)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(4)
            .annotationBoundary(beginAnnotation("hello", "initial", "there"))
            .retain(1)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build()
    ).run();
    // client's incontiguous annotation overlaps server's annotation
    new TestParameters(
        new DocOpBuilder()
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(3)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(2)
            .annotationBoundary(finishAnnotation("hello"))
            .retain(11)
            .build(),
        DocOpCreator.setAnnotation(20, 4, 8, "hello", "initial", "there"),
        new DocOpBuilder()
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "initial", "world"))
            .retain(2)
            .annotationBoundary(beginAnnotation("hello", "there", "world"))
            .retain(1)
View Full Code Here

  private static void testEquality(DocOp expected, DocOp actual) {
    assertEquals(DocOpUtil.toConciseString(expected), DocOpUtil.toConciseString(actual));
  }

  private static DocOp sampleStructural(int size, int location) {
    return new DocOpBuilder()
        .retain(location)
        .elementStart("sampleElement", Attributes.EMPTY_MAP)
        .characters("sample text")
        .elementEnd()
        .retain(size - location)
View Full Code Here

    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS1)
        .retain(1)
        .annotationBoundary(ANNOTATIONS2)
        .retain(1)
View Full Code Here

    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS12)
        .retain(1)
        .annotationBoundary(ANNOTATIONS3)
        .retain(1)
View Full Code Here

    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS1)
        .retain(1)
        .annotationBoundary(ANNOTATIONS23)
        .retain(1)
View Full Code Here

    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS123)
        .retain(1)
        .annotationBoundary(ANNOTATIONS4)
        .retain(1)
View Full Code Here

    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS123)
        .retain(1)
        .annotationBoundary(ANNOTATIONS4)
        .retain(1)
View Full Code Here

    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS123)
        .retain(1)
        .annotationBoundary(ANNOTATIONS4)
        .retain(1)
View Full Code Here

    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS123)
        .retain(1)
        .annotationBoundary(ANNOTATIONS4)
        .retain(1)
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.