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


Java DocOpBuilder.retain方法代码示例

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


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

示例1: checkInsert

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
private void checkInsert(WaveletOperation operation, int location, String content,
    int remaining) {
  if (operation instanceof WaveletBlipOperation) {
    WaveletBlipOperation waveOp = (WaveletBlipOperation) operation;
    if (waveOp.getBlipOp() instanceof BlipContentOperation) {
      BlipContentOperation blipOp = (BlipContentOperation) waveOp.getBlipOp();
      DocOpBuilder builder = new DocOpBuilder();
      builder.retain(location).characters(content);
      if (remaining > 0) {
          builder.retain(remaining);
      }
      assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(builder.build(), blipOp.getContentOp()));
      return;
    }
  }
  fail("Did not get an insertion operation.");
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:18,代码来源:DeltaPairTest.java

示例2: testRetain

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
public void testRetain() {
  DocOpBuilder m = new DocOpBuilder();

  m.characters("hello");
  m.retain(5);
  m.characters("world");
  m.retain(10);
  m.characters("foo");
  m.retain(13);
  m.characters("bar");
  m.retain(16);

  assertReversible(makeBlipOp("retain", m.build()));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:15,代码来源:WaveletOperationSerializerTest.java

示例3: testDeleteCharacters

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
public void testDeleteCharacters() {
  DocOpBuilder m = new DocOpBuilder();

  m.characters("hello");
  m.retain(1);
  m.deleteCharacters("ab");
  m.characters("world");
  m.retain(2);
  m.deleteCharacters("cd");

  assertReversible(makeBlipOp("deleteCharacters", m.build()));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:13,代码来源:WaveletOperationSerializerTest.java

示例4: testReplaceAttributes

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
public void testReplaceAttributes() {
  DocOpBuilder m = new DocOpBuilder();

  Attributes oldA = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
  Attributes newA = new AttributesImpl(ImmutableMap.of("a1", "3", "a2", "4"));

  m.retain(4);
  m.replaceAttributes(oldA, newA);
  m.retain(4);

  assertReversible(makeBlipOp("replaceAttributes", m.build()));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:13,代码来源:WaveletOperationSerializerTest.java

示例5: testEmptyReplaceAttributes

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
public void testEmptyReplaceAttributes() {
  DocOpBuilder m = new DocOpBuilder();

  m.retain(4);
  m.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
  m.retain(4);

  assertReversible(makeBlipOp("emptyReplaceAttributes", m.build()));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:10,代码来源:WaveletOperationSerializerTest.java

示例6: testUpdateAttributes

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
public void testUpdateAttributes() {
  DocOpBuilder m = new DocOpBuilder();

  AttributesUpdate u = new AttributesUpdateImpl(new String[]{"a", null, "2", "b", "1", null});

  m.retain(4);
  m.updateAttributes(u);
  m.retain(4);

  assertReversible(makeBlipOp("updateAttributes", m.build()));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:12,代码来源:WaveletOperationSerializerTest.java

示例7: testEmptyUpdateAttributes

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
public void testEmptyUpdateAttributes() {
  DocOpBuilder m = new DocOpBuilder();

  m.retain(4);
  m.updateAttributes(AttributesUpdateImpl.EMPTY_MAP);
  m.retain(4);

  assertReversible(makeBlipOp("emptyUpdateAttributes", m.build()));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:10,代码来源:WaveletOperationSerializerTest.java

示例8: insert

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
/**
 * Creates an XmlInsert with the given data.
 */
public WaveletOperation insert(int pos, String text, int remaining,
    HashedVersion resultingVersion) {
  DocOpBuilder builder = new DocOpBuilder();
  builder.retain(pos).characters(text);
  if (remaining > 0) {
    builder.retain(remaining);
  }
  BlipContentOperation blipOp = new BlipContentOperation(
      new WaveletOperationContext(author, 0L, -1, resultingVersion), builder.build());
  WaveletBlipOperation waveOp = new WaveletBlipOperation("blip id", blipOp);
  return waveOp;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:16,代码来源:DeltaTestUtil.java

示例9: insert

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
/**
 * Creates an XmlInsert with the given data.
 */
public WaveletOperation insert(int pos, String text, int remaining,
    HashedVersion resultingVersion) {
  DocOpBuilder builder = new DocOpBuilder();
  builder.retain(pos).characters(text);
  if (remaining > 0) {
    builder.retain(remaining);
  }
  BlipContentOperation blipOp = new BlipContentOperation(
      new WaveletOperationContext(author, 0L, 1, resultingVersion), builder.build());
  WaveletBlipOperation waveOp = new WaveletBlipOperation("blip id", blipOp);
  return waveOp;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:16,代码来源:DeltaTestUtil.java

示例10: testScrubs

import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入方法依赖的package包/类
public void testScrubs() {
  DocOpBuilder b1 = new DocOpBuilder();
  DocOpBuilder b2 = new DocOpBuilder();

  b1.characters(VALID);
  b2.characters(VALID_SCRUBBED);

  b1.deleteCharacters(VALID);
  b2.deleteCharacters(VALID_SCRUBBED);

  b1.characters(INVALID);
  b2.characters(INVALID_SCRUBBED);

  b1.deleteCharacters(INVALID);
  b2.deleteCharacters(INVALID_SCRUBBED);

  b1.elementStart("abc", ATTRS);
  b2.elementStart("abc", ATTRS_SCRUBBED);

  b1.elementEnd();
  b2.elementEnd();

  b1.deleteElementStart("abc", ATTRS);
  b2.deleteElementStart("abc", ATTRS_SCRUBBED);

  b1.deleteElementEnd();
  b2.deleteElementEnd();

  b1.retain(5);
  b2.retain(5);

  b1.replaceAttributes(ATTRS, ATTRS);
  b2.replaceAttributes(ATTRS_SCRUBBED, ATTRS_SCRUBBED);

  b1.updateAttributes(ATTRSUP);
  b2.updateAttributes(ATTRSUP_SCRUBBED);

  b1.annotationBoundary(ANNO);
  b2.annotationBoundary(ANNO_SCRUBBED);

  DocOp o1 = DocOpScrub.scrub(b1.buildUnchecked());
  DocOp o2 = b2.buildUnchecked();
  assertTrue("\n" + o1 + "\n but expected \n" + o2,
      OpComparators.SYNTACTIC_IDENTITY.equal(o1, o2));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:46,代码来源:DocOpScrubTest.java


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