当前位置: 首页>>代码示例>>Java>>正文


Java BlipContentOperation.getContributorMethod方法代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.operation.wave.BlipContentOperation.getContributorMethod方法的典型用法代码示例。如果您正苦于以下问题:Java BlipContentOperation.getContributorMethod方法的具体用法?Java BlipContentOperation.getContributorMethod怎么用?Java BlipContentOperation.getContributorMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.waveprotocol.wave.model.operation.wave.BlipContentOperation的用法示例。


在下文中一共展示了BlipContentOperation.getContributorMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeSegmentOperations

import org.waveprotocol.wave.model.operation.wave.BlipContentOperation; //导入方法依赖的package包/类
@Timed
static Map<SegmentId, SegmentOperation> makeSegmentOperations(WaveletDeltaRecord delta) {
  LoadingCache<SegmentId, ImmutableList.Builder<WaveletOperation>> builders = CacheBuilder.newBuilder().build(
    new CacheLoader<SegmentId, ImmutableList.Builder<WaveletOperation>>(){

    @Override
    public ImmutableList.Builder<WaveletOperation> load(SegmentId segmentId) {
      return ImmutableList.builder();
    }
  });
  Map<SegmentId, SegmentOperation> segmentOperations = CollectionUtils.newHashMap();
  for (WaveletOperation op : delta.getTransformedDelta()) {
    WaveletOperationContext newContext = makeSegmentContext(op.getContext(), delta.getResultingVersion().getVersion());
    if (op instanceof AddParticipant) {
      builders.getUnchecked(SegmentId.PARTICIPANTS_ID).add(
        new AddParticipant(newContext, ((AddParticipant)op).getParticipantId()));
    } else if (op instanceof RemoveParticipant) {
      builders.getUnchecked(SegmentId.PARTICIPANTS_ID).add(
        new RemoveParticipant(newContext, ((RemoveParticipant)op).getParticipantId()));
    } else if (op instanceof NoOp) {
      builders.getUnchecked(SegmentId.PARTICIPANTS_ID).add(new NoOp(newContext));
    } else {
      WaveletBlipOperation blipOp = (WaveletBlipOperation)op;
      BlipContentOperation blipContentOp = (BlipContentOperation)blipOp.getBlipOp();
      BlipContentOperation newBlipContentOp = new BlipContentOperation(newContext,
        blipContentOp.getContentOp(), blipContentOp.getContributorMethod());
      WaveletBlipOperation newBlipOp = new WaveletBlipOperation(blipOp.getBlipId(), newBlipContentOp);
      builders.getUnchecked(SegmentId.ofBlipId(blipOp.getBlipId())).add(newBlipOp);
    }
  }
  for (Entry<SegmentId, ImmutableList.Builder<WaveletOperation>> entry : builders.asMap().entrySet()) {
    segmentOperations.put(entry.getKey(), new SegmentOperationImpl(entry.getValue().build()));
  }
  return segmentOperations;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:36,代码来源:SegmentWaveletStateImpl.java

示例2: serializeOperation

import org.waveprotocol.wave.model.operation.wave.BlipContentOperation; //导入方法依赖的package包/类
private void serializeOperation(WaveletOperation operation, ProtoWaveletOperation serialized) {
  if (operation instanceof AddSegment) {
    serialized.setAddSegment(
      serializeOptionalSegmentId(((AddSegment)operation).getSegmentId()));
  } else if (operation instanceof RemoveSegment) {
    serialized.setRemoveSegment(
      serializeOptionalSegmentId(((RemoveSegment)operation).getSegmentId()));
  } else if (operation instanceof StartModifyingSegment) {
    serialized.setStartModifyingSegment(
      serializeOptionalSegmentId(((StartModifyingSegment)operation).getSegmentId()));
  } else if (operation instanceof EndModifyingSegment) {
    serialized.setEndModifyingSegment(
      serializeOptionalSegmentId(((EndModifyingSegment)operation).getSegmentId()));
  } else if (operation instanceof AddParticipant) {
    serialized.setAddParticipant(((AddParticipant)operation).getParticipantId().getAddress());
  } else if (operation instanceof RemoveParticipant) {
    serialized.setRemoveParticipant(((RemoveParticipant)operation).getParticipantId().getAddress());
  } else if (operation instanceof WaveletBlipOperation) {
    WaveletBlipOperation waveletOp = (WaveletBlipOperation)operation;
    BlipContentOperation blipOp = (BlipContentOperation)waveletOp.getBlipOp();
    switch (blipOp.getContributorMethod()) {
    case ADD:
      serialized.setAddDocumentContributor(true);
      break;
    case REMOVE:
      serialized.setRemoveDocumentContributor(true);
      break;
    }
    serialized.setDocumentOperation(operationSerializer.serialize(blipOp.getContentOp()));
  } else if (operation instanceof NoOp) {
    serialized.setNoOp(true);
  } else {
    throw new RuntimeException("Bad operation type");
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:36,代码来源:RawOperationSerializer.java


注:本文中的org.waveprotocol.wave.model.operation.wave.BlipContentOperation.getContributorMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。