Examples of DocOp


Examples of com.google.collide.dto.DocOp

    }
  }

  public static DocOp createFromTextChange(DocOpFactory factory, TextChange textChange) {

    DocOp docOp = factory.createDocOp();
    JsonArray<DocOpComponent> components = docOp.getComponents();

    int lineNumber = textChange.getLineNumber();
    if (lineNumber > 0) {
      components.add(factory.createRetainLine(lineNumber));
    }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

        DocHelper.getLastElementWithTagName(doc, TAG));
  }

  public void testAtomicReplacementOfEquivalentFiresNoEvents() {
    target.set("42");
    DocOp replacement = createReplaceOp(createErasureOp(), createRestoreOp());
    target.addListener(listener);
    doc.hackConsume(Nindo.fromDocOp(replacement, false));
    listener.verifyNoEvent();
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

  }

  public void testAtomicReplacementFiresSingleEvent() {
    // Build "insert 42" state.
    target.set("42");
    DocOp restore = createRestoreOp();

    // Build "delete 43" state.
    target.set("43");
    DocOp erasure = createErasureOp();

    DocOp restoration = createReplaceOp(erasure, restore);
    target.addListener(listener);
    doc.hackConsume(Nindo.fromDocOp(restoration, false));
    listener.verifyValueChanged(43, 42);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

  public void testDocOp() {
    OpEquator eq = OpComparators.SYNTACTIC_IDENTITY;

    DocOpBuffer ba1 = new DocOpBuffer();
    ba1.characters("a");
    DocOp a1 = ba1.finish();

    DocOpBuffer ba2 = new DocOpBuffer();
    ba2.characters("a");
    DocOp a2 = ba2.finish();

    DocOpBuffer bb1 = new DocOpBuffer();
    bb1.deleteCharacters("a");
    DocOp b1 = bb1.finish();

    DocOpBuffer bb2 = new DocOpBuffer();
    bb2.deleteCharacters("a");
    DocOp b2 = bb1.finish();

    assertTrue(eq.equal(a1, a1));
    assertTrue(eq.equal(a1, a2));
    assertTrue(eq.equal(a2, a1));
    assertTrue(eq.equal(a2, a2));
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

    for (int i = 0; i < 200; i++) {
      BootstrapDocument doc = new BootstrapDocument();
      for (int j = 0; j < 20; j++) {
        RandomProvider ra = RandomProviderImpl.ofSeed(i * 20 + j);
        RandomProvider rb = RandomProviderImpl.ofSeed(i * 20 + j + 1);
        DocOp a = RandomDocOpGenerator.generate(ra, p, doc);
        DocOp b = RandomDocOpGenerator.generate(rb, p, doc);
        doc.consume(a);
        assertTrue(eq.equal(a, a));
        // The combination of RandomProvider and RandomDocOpGenerator doesn't
        // really guarantee this property, but it happens to be true with the
        // random seeds that occur here.
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

  }

  private BlipOperation createSampleContentOperation(WaveletOperationContext context,
      UpdateContributorMethod method) {
    // Some random op that doesn't actually update the document but still "isWorthy"
    DocOp op = new DocOpBuilder()
        .retain(1)
        .deleteElementStart("line", Attributes.EMPTY_MAP)
        .deleteElementEnd()
        .elementStart("line", Attributes.EMPTY_MAP)
        .elementEnd()
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

  protected void tearDown() throws Exception {
    super.tearDown();
  }

  public void testBlipContentOperationVisitor() {
    DocOp docOp = ModelTestUtils.createContent("Hello");
    BlipContentOperation op = new BlipContentOperation(context, docOp);
    op.acceptVisitor(visitor);
    assertEquals(op, visitor.visitedBlipContentOperation);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

    return waveletOp;
  }

  private WaveletOperation mutateBlip(WaveletOperationContext context, String blipId)
      throws OperationException {
    DocOp docOp = ModelTestUtils.createContent("Hello");
    BlipOperation blipOp = new BlipContentOperation(LOCAL_CONTEXT, docOp);
    WaveletOperation waveletBlipOp = new WaveletBlipOperation(blipId, blipOp);
    waveletBlipOp.apply(waveletData);
    return waveletBlipOp;
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

            .characters("a")
            .elementStart(WorthyChangeChecker.THREAD_INLINE_ANCHOR_TAGNAME, Attributes.EMPTY_MAP)
            .elementEnd()
            .build(),
        DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    DocOp op = d.consumeAndReturnInvertible(new Nindo.Builder() {
      {
        skip(2);
        deleteElementStart();
        deleteElementEnd();
      }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.DocOp

            .elementStart(WorthyChangeChecker.THREAD_INLINE_ANCHOR_TAGNAME, Attributes.EMPTY_MAP)
            .elementEnd()
            .annotationBoundary(new AnnotationBoundaryMapBuilder().end("a").build())
            .build(),
        DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    DocOp op = d.consumeAndReturnInvertible(new Nindo.Builder() {
      {
        deleteElementStart();
        deleteElementEnd();
      }
    }.build());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.