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


Java DocOpCollector类代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.document.operation.algorithm.DocOpCollector的典型用法代码示例。如果您正苦于以下问题:Java DocOpCollector类的具体用法?Java DocOpCollector怎么用?Java DocOpCollector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DocOpCollector类属于org.waveprotocol.wave.model.document.operation.algorithm包,在下文中一共展示了DocOpCollector类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compact

import org.waveprotocol.wave.model.document.operation.algorithm.DocOpCollector; //导入依赖的package包/类
@Override
public List<DocOp> compact(List<DocOp> clientOps) {
  if (clientOps.isEmpty()) {
    return clientOps;
  }
  DocOpCollector c = new DocOpCollector();
  for (DocOp op : clientOps) {
    c.add(op);
  }
  return ImmutableList.of(c.composeAll());
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:12,代码来源:ChannelTestUtil.java

示例2: DocDiff

import org.waveprotocol.wave.model.document.operation.algorithm.DocOpCollector; //导入依赖的package包/类
DocDiff(long lastReadVersion) {
  Preconditions.checkArgument(lastReadVersion >= 0, "lastReadVersion = %s", lastReadVersion);
  this.lastReadVersion = lastReadVersion;
  this.state = new DocOpCollector();
  this.diff = new DocOpCollector();
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:7,代码来源:WaveSerializer.java

示例3: collectInto

import org.waveprotocol.wave.model.document.operation.algorithm.DocOpCollector; //导入依赖的package包/类
@Override
void collectInto(DocOpCollector collector) {
  collector.add(docOp);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:5,代码来源:DocOpList.java

示例4: composeAll

import org.waveprotocol.wave.model.document.operation.algorithm.DocOpCollector; //导入依赖的package包/类
/**
 * Composes all the operations together and returns the result.
 *
 * @return The composition of all the operations in the list.
 */
DocOp composeAll() {
  DocOpCollector collector = new DocOpCollector();
  collectInto(collector);
  return collector.composeAll();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:11,代码来源:DocOpList.java

示例5: transform

import org.waveprotocol.wave.model.document.operation.algorithm.DocOpCollector; //导入依赖的package包/类
/**
 * Transforms a pair of operations.
 *
 * @param clientOp the operation from the client
 * @param serverOp the operation from the server
 * @return the transformed pair of operations
 * @throws TransformException if a problem was encountered during the
 *         transformation process
 */
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);
    ci = r.clientOp();
    sp = r.serverOp();
    r = new InsertionPreservationTransformer().transformOperations(si, cp);
    si = r.clientOp();
    cp = r.serverOp();
    r = new InsertionDeletionTransformer().transformOperations(ci, sd);
    ci = r.clientOp();
    sd = r.serverOp();
    r = new InsertionDeletionTransformer().transformOperations(si, cd);
    si = r.clientOp();
    cd = r.serverOp();
    DocOpCollector clientCollector = new DocOpCollector();
    DocOpCollector serverCollector = new DocOpCollector();
    clientCollector.add(ci);
    serverCollector.add(si);
    while (!AnnotationTamenessChecker.checkTameness(cp, sp, cd, sd)) {
      r = new PreservationPreservationTransformer().transformOperations(cp, sp);
      cp = r.clientOp();
      sp = r.serverOp();
      Pair<DocOp, Pair<DocOp, DocOp>> rc =
          new PreservationDeletionTransformer().transformOperations(cp, sd);
      Pair<DocOp, Pair<DocOp, DocOp>> rs =
          new PreservationDeletionTransformer().transformOperations(sp, cd);
      clientCollector.add(rc.first);
      serverCollector.add(rs.first);
      sp = rc.second.first;
      sd = rc.second.second;
      cp = rs.second.first;
      cd = rs.second.second;
    }
    r = new DeletionDeletionTransformer().transformOperations(cd, sd);
    cd = r.clientOp();
    sd = r.serverOp();
    clientCollector.add(cd);
    serverCollector.add(sd);
    return new OperationPair<DocOp>(
        clientCollector.composeAll(), serverCollector.composeAll());
  // We're catching runtime exceptions here, but checked exceptions may be better.
  } catch (RuntimeException e) {
    throw new TransformException(e);
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:68,代码来源:ReferenceTransformer.java


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