當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。