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

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


          }
          continue;
      }
    }

    DocOp op = builder.build();
    return DocOpUtil.asInitialization(op);
  }
View Full Code Here


  /**
   * Returns a randomly-generated document operation based on the given document,
   * parameters, and schema.
   */
  public static DocOp generate(RandomProvider r, Parameters p, AutomatonDocument doc) {
    DocOp op = new Generator(r, p, doc).generate();
    ViolationCollector v = new ViolationCollector();
    DocOpValidator.validate(v, null, doc, op);
    assert !v.isIllFormed();
    assert p.getValidity() == v.isValid();
    return op;
View Full Code Here

      doc.consume(initialDoc.asOperation());
      for (int j = 0; j < 20; j++) {
        System.err.println("i=" + i + ", j=" + j);
        System.err.println("old: " + DocOpUtil.toXmlString(doc.asOperation()));
        System.err.println("old: " + DocOpUtil.toConciseString(doc.asOperation()));
        DocOp op = generate(r, p, doc);
        System.err.println("op:  " + DocOpUtil.toConciseString(op));
        doc.consume(op);
        System.err.println("new: " + DocOpUtil.toConciseString(doc.asOperation()));
        System.err.println("new: " + DocOpUtil.toXmlString(doc.asOperation()));
        if (!DocOpValidator.validate(null, DocumentSchema.NO_SCHEMA_CONSTRAINTS,
View Full Code Here

    //
    // See http://groups.google.com/group/wave-protocol/msg/eb1e7293b26ff61b
    //
    ListIterator<DocOp> iterator = operations.listIterator();
    while (iterator.hasNext()) {
      DocOp nextOperation = iterator.next();
      if (nextOperation == null) {
        iterator.set(operation);
        return;
      }
      iterator.set(null);
View Full Code Here

    }
    operations.add(operation);
  }

  public DocOp composeAll() {
    DocOp result = null;
    for (DocOp operation : operations) {
      if (operation != null) {
        result = (result != null) ? compose(operation, result) : operation;
      }
    }
View Full Code Here

  /**
   * Creates an XmlDelete with the given data.
   */
  public WaveletOperation delete(int posStart, String characters, int remaining) {
    DocOp op = new DocOpBuilder()
        .retain(posStart)
        .deleteCharacters(characters)
        .retain(remaining)
        .build();
    BlipContentOperation blipOp = new BlipContentOperation(
View Full Code Here

   * Creates a random op. The result is unlikely to be applicable to any
   * wavelet, but is generated such that we are fairly certain that it will be
   * unique so we can identify it when it completes a round-trip.
   */
  private WaveletOperation randomOp(WaveletOperationContext context) {
    DocOp blipOp = new DocOpBuilder()
        .retain(Math.abs(random.nextInt()) / 2 + 1)
        .characters("createRndOp#" + random.nextInt())
        .build();
    return new WaveletBlipOperation("createRndId#" + random.nextInt(),
        new BlipContentOperation(context, blipOp));
View Full Code Here

    return ParticipantId.of(address);
  }

  private static void addDocumentSnapshotToWavelet(
      DocumentSnapshot snapshot, WaveletData container) throws InvalidParticipantAddress {
    DocOp op = CoreWaveletOperationSerializer.deserialize(snapshot.getDocumentOperation());
    DocInitialization docInit = DocOpUtil.asInitialization(op);

    Collection<ParticipantId> contributors = CollectionUtils.newArrayList();
    for (String p : snapshot.getContributorList()) {
      contributors.add(getParticipantId(p));
View Full Code Here

      ParticipantId participantId = ((CoreAddParticipant) op).getParticipantId();
      return new AddParticipant(context, participantId);
    } else if (op instanceof CoreWaveletDocumentOperation) {
      CoreWaveletDocumentOperation waveletDocOp = (CoreWaveletDocumentOperation) op;
      String documentId = waveletDocOp.getDocumentId();
      DocOp operation = waveletDocOp.getOperation();
      return new WaveletBlipOperation(documentId, new BlipContentOperation(context, operation));
    }

    throw new RuntimeException("unhandled operation type");
  }
View Full Code Here

    // Have to add a single participant for the copying to complete without a
    // NPE.
    coreWavelet.addParticipant(ParticipantId.ofUnsafe(snapshot.getParticipantId(0)));

    for (DocumentSnapshot document : snapshot.getDocumentList()) {
      DocOp op =
          CoreWaveletOperationSerializer.deserialize(document.getDocumentOperation());
      coreWavelet.modifyDocument(document.getDocumentId(), op);
    }

    HashedVersion hashedVersion = CoreWaveletOperationSerializer.deserialize(version);
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.DocOp$IsDocOp

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.