當前位置: 首頁>>代碼示例>>Java>>正文


Java ProtocolWaveletDelta.Builder方法代碼示例

本文整理匯總了Java中org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java ProtocolWaveletDelta.Builder方法的具體用法?Java ProtocolWaveletDelta.Builder怎麽用?Java ProtocolWaveletDelta.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta的用法示例。


在下文中一共展示了ProtocolWaveletDelta.Builder方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convertDelta

import org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta; //導入方法依賴的package包/類
/**
 * Replaces domain in deltas for Add/Remove participant operations.
 *
 * @param delta source delta
 * @param waveDomain target wave domain
 * @return delta for waveDomain if WaveDoamin is not null, otherwise source delta.
 * @throws InvalidParticipantAddress if there is a problem with deserialization of participant id.
 */
public static ProtocolWaveletDelta convertDelta(ProtocolWaveletDelta delta,
    String waveDomain) throws InvalidParticipantAddress {
  if (waveDomain != null) {
    ProtocolWaveletDelta.Builder newDelta = ProtocolWaveletDelta.newBuilder(delta);
    ParticipantId author = convertParticipantId(delta.getAuthor(), waveDomain);
    newDelta.setAuthor(author.getAddress());
    for (int i = 0; i < delta.getOperationCount(); i++) {
      ProtocolWaveletOperation op = delta.getOperation(i);
      ProtocolWaveletOperation.Builder newOp = ProtocolWaveletOperation.newBuilder(op);
      if (op.hasAddParticipant()) {
        convertAddParticipantOperation(newOp, op, waveDomain);
      } else if (op.hasRemoveParticipant()) {
        convertRemoveParticipantOperation(newOp, op, waveDomain);
      }
      // TODO(user) release convert for other operations.
      newDelta.setOperation(i, newOp);
    }
    return newDelta.build();
  } else {
    return delta;
  }
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:31,代碼來源:DomainConverter.java

示例2: serialize

import org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta; //導入方法依賴的package包/類
/**
 * Serializes an untransformed delta as a {@link ProtocolWaveletDelta}.
 *
 * @param delta to serialize
 * @return serialized protocol buffer wavelet delta
 */
public static ProtocolWaveletDelta serialize(WaveletDelta delta) {
 ProtocolWaveletDelta.Builder protobufDelta = ProtocolWaveletDelta.newBuilder();

 for (WaveletOperation waveletOp : delta) {
   protobufDelta.addOperation(serialize(waveletOp));
 }
 protobufDelta.setAuthor(delta.getAuthor().getAddress());
 protobufDelta.setHashedVersion(serialize(delta.getTargetVersion()));

 return protobufDelta.build();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:18,代碼來源:OperationSerializer.java

示例3: setVersionHash

import org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta; //導入方法依賴的package包/類
/**
 * Sets correct version hash to delta.
 *
 * @param delta the source delta.
 * @param waveletSnapshot to append delta.
 * @param waveletName name of wavelet.
 * @return the delta to import.
 * @throws InvalidParticipantAddress deserialize of participant error.
 */
ProtocolWaveletDelta setVersionHash(ProtocolWaveletDelta delta,
    HashedVersion currentVersion, WaveletName waveletName) throws InvalidParticipantAddress {
  ProtocolWaveletDelta.Builder newDelta = ProtocolWaveletDelta.newBuilder(delta);
  ProtocolHashedVersion ver = ProtocolHashedVersion.newBuilder(delta.getHashedVersion()).
      setHistoryHash(ByteString.copyFrom(currentVersion.getHistoryHash())).
      build();
  newDelta.setHashedVersion(ver);
  return newDelta.build();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:19,代碼來源:ImportDeltasService.java


注:本文中的org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta.Builder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。