Examples of DocOp


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

      BootstrapDocument document= new BootstrapDocument();
      for (int i = 0; i < INITIAL_MUTATION_COUNT; ++i) {
        document.consume(generator.randomOperation(document, r));
      }
      for (int i = 0; i < FEATURE_ITERATION_COUNT; ++i) {
        DocOp clientOp = generator.randomOperation(document, r);
        DocOp serverOp = generator.randomOperation(document, r);
        OperationPair<DocOp> pair = Transformer.transform(clientOp, serverOp);
        OperationPair<DocOp> referencePair =
            ReferenceTransformer.transform(clientOp, serverOp);
        assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
            pair.clientOp(), referencePair.clientOp()));
View Full Code Here

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

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

    DocOpBuffer b = new DocOpBuffer();
    b.characters("a");
    DocOp d = b.finish();

    CoreWaveletDocumentOperation a1 = new CoreWaveletDocumentOperation("a", d);
    CoreWaveletDocumentOperation a2 = new CoreWaveletDocumentOperation("a", d);
    CoreWaveletDocumentOperation b1 = new CoreWaveletDocumentOperation("b", d);
    CoreWaveletDocumentOperation b2 = new CoreWaveletDocumentOperation("b", d);
View Full Code Here

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

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

    DocOpBuffer ba = new DocOpBuffer();
    ba.characters("a");
    DocOp da = ba.finish();
    DocOpBuffer bb = new DocOpBuffer();
    bb.deleteCharacters("a");
    DocOp db = bb.finish();

    CoreWaveletDocumentOperation a1 = new CoreWaveletDocumentOperation("a", da);
    CoreWaveletDocumentOperation a2 = new CoreWaveletDocumentOperation("a", da);
    CoreWaveletDocumentOperation b1 = new CoreWaveletDocumentOperation("a", db);
    CoreWaveletDocumentOperation b2 = new CoreWaveletDocumentOperation("a", db);
View Full Code Here

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

  public static OperationPair<DocOp> transform(DocOp clientOp,
      DocOp serverOp) throws TransformException {
    try {
      Decomposition c = Decomposer.decompose(clientOp);
      Decomposition s = Decomposer.decompose(serverOp);
      DocOp ci = c.insertion;
      DocOp cp = c.preservation;
      DocOp cd = c.deletion;
      DocOp si = s.insertion;
      DocOp sp = s.preservation;
      DocOp sd = s.deletion;
      OperationPair<DocOp> r =
          new InsertionInsertionTransformer().transformOperations(ci, si);
      ci = r.clientOp();
      si = r.serverOp();
      r = new InsertionPreservationTransformer().transformOperations(ci, sp);
View Full Code Here

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

      }

      @Override
      public void consume(Nindo op) {
        try {
          DocOp docOp = doc.consumeAndReturnInvertible(op);
          if (outputSink != null) {
            outputSink.consume(docOp);
          }
        } catch (OperationException oe) {
          throw new OperationRuntimeException("DocProviders trivial sequencer consume failed.", oe);
View Full Code Here

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

        logger.log(Level.TRACE, "cannot undo " + undoSelectionStack.size());
      }
      return;
    }

    DocOp undo = pair.first;
    DocOp transformedNonUndoable = pair.second;

    {
      FocusedRange selection = selectionHelper.getSelectionRange();

      if (selection != null) {
View Full Code Here

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

        logger.log(Level.TRACE, "cannot redo " + redoSelectionStack.size());
      }
      return;
    }

    DocOp redo = pair.first;
    DocOp transformedNonUndoable = pair.second;

    {
      FocusedRange selection = selectionHelper.getSelectionRange();

      if (selection != null) {
View Full Code Here

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

      );
      assertEquals(expected, composed.toWaveletOperations());
    }

    {
      DocOp insertDocOp = insertDocOp(1, 5);
      WaveAggregateOp op1 = new WaveOpBuilder(CREATOR1_ID).addParticipant(TARGET1).build();
      WaveAggregateOp op2 = new WaveOpBuilder(CREATOR2_ID).docOp("doc", insertDocOp).build();


      WaveAggregateOp composed = compose(op1, op2);

      List<WaveletOperation> expected = Arrays.<WaveletOperation>asList(
          new AddParticipant(CREATOR1_CONTEXT, new ParticipantId(TARGET1)),
          new WaveletBlipOperation("doc", new BlipContentOperation(CREATOR2_CONTEXT, insertDocOp))
      );
      assertEquals(expected, composed.toWaveletOperations());
    }

    // Test compose of document op from the same creator
    {
      DocOp insertDocOp1 = insertDocOp(1, 3);
      DocOp insertDocOp2 = insertDocOp(3, 4);
      DocOp deleteDocOp = deleteDocOp(2, 5);
      WaveAggregateOp op1 = new WaveOpBuilder(CREATOR1_ID).docOp("doc", insertDocOp1).build();
      WaveAggregateOp op2 = new WaveOpBuilder(CREATOR1_ID)
          .docOp("doc", insertDocOp2)
          .docOp("doc", deleteDocOp)
          .build();

      WaveAggregateOp composed = compose(op1, op2);

      DocOp expectedDocOp = new DocOpBuilder()
          .retain(1)
          .characters("a")
          .deleteCharacters("a")
          .characters("a")
          .retain(1)
View Full Code Here

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

    normalizer.retain(1);
    normalizer.retain(1);
    normalizer.retain(1);
    normalizer.characters("b");
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .characters("a")
        .retain(3)
        .characters("b")
        .retain(1)
View Full Code Here

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

    normalizer.retain(1);
    normalizer.characters("a");
    normalizer.retain(0);
    normalizer.characters("b");
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .characters("ab")
        .retain(1)
        .build();
    assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
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.