本文整理汇总了Java中org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder类的典型用法代码示例。如果您正苦于以下问题:Java DocOpBuilder类的具体用法?Java DocOpBuilder怎么用?Java DocOpBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DocOpBuilder类属于org.waveprotocol.wave.model.document.operation.impl包,在下文中一共展示了DocOpBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newWorthyDocumentOperation
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
private DocOp newWorthyDocumentOperation(DocInitialization content, boolean first) {
int size = DocOpUtil.resultingDocumentLength(content);
String key = "walkaround-irrelevant-annotation-change-to-force-contribution";
while (containsAnnotationKey(content, key)) {
key += "1";
}
return new DocOpBuilder()
.annotationBoundary(
new AnnotationBoundaryMapBuilder().change(key,
first ? null : "a",
first ? "a" : null)
.build())
.retain(size)
.annotationBoundary(new AnnotationBoundaryMapBuilder().end(key).build())
.build();
}
示例2: testOperationsOfDifferentSizes
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testOperationsOfDifferentSizes() throws Exception {
String docId = "b+somedoc";
DocOp docOp1 = new DocOpBuilder().characters("hi").build();
WaveletDelta delta1 = createDelta(docId, docOp1, localVersion0);
WaveServerTestUtil.applyDeltaToWavelet(localWavelet, delta1, 0L);
try {
DocOp docOp2 = new DocOpBuilder().characters("bye").build();
WaveletDelta delta2 = createDelta(docId, docOp2, localWavelet.getLastModifiedVersion());
WaveServerTestUtil.applyDeltaToWavelet(localWavelet, delta2, 0L);
fail("Composition of \"hi\" and \"bye\" did not throw OperationException");
} catch (WaveletStateException expected) {
// Correct
}
}
示例3: testElements
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testElements() {
DocOpBuilder m = new DocOpBuilder();
Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
Attributes b = new AttributesImpl();
Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));
m.elementStart("a", a);
m.elementStart("b", b);
m.elementStart("c", c);
m.elementEnd();
m.elementEnd();
m.elementEnd();
assertReversible(makeBlipOp("elements", m.build()));
}
示例4: testCharactersAndElements
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testCharactersAndElements() {
DocOpBuilder m = new DocOpBuilder();
Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
Attributes b = new AttributesImpl();
Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));
m.elementStart("a", a);
m.characters("hello");
m.elementStart("b", b);
m.characters("world");
m.elementStart("c", c);
m.elementEnd();
m.characters("blah");
m.elementEnd();
m.elementEnd();
assertReversible(makeBlipOp("charactersAndElements", m.build()));
}
示例5: testDeleteElements
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testDeleteElements() {
DocOpBuilder m = new DocOpBuilder();
Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
Attributes b = new AttributesImpl();
Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));
m.deleteElementStart("a", a);
m.deleteElementStart("b", b);
m.deleteElementStart("c", c);
m.deleteElementEnd();
m.deleteElementEnd();
m.deleteElementEnd();
assertReversible(makeBlipOp("deleteElements", m.build()));
}
示例6: testDeleteCharactersAndElements
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testDeleteCharactersAndElements() {
DocOpBuilder m = new DocOpBuilder();
Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
Attributes b = new AttributesImpl();
Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));
m.deleteElementStart("a", a);
m.deleteCharacters("hello");
m.deleteElementStart("b", b);
m.deleteCharacters("world");
m.deleteElementStart("c", c);
m.deleteElementEnd();
m.deleteCharacters("blah");
m.deleteElementEnd();
m.deleteElementEnd();
assertReversible(makeBlipOp("deleteCharactersAndElements", m.build()));
}
示例7: testAnnotationBoundary
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testAnnotationBoundary() {
DocOpBuilder m = new DocOpBuilder();
Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
AnnotationBoundaryMap mapA = new AnnotationBoundaryMapImpl(
new String[]{},new String[]{"a"},new String[]{null},new String[]{"b"});
AnnotationBoundaryMap mapB = new AnnotationBoundaryMapImpl(
new String[]{},new String[]{"a"},new String[]{"b"},new String[]{null});
AnnotationBoundaryMap mapC = new AnnotationBoundaryMapImpl(
new String[]{"a"},new String[]{},new String[]{},new String[]{});
m.elementStart("a", a);
m.annotationBoundary(mapA);
m.characters("test");
m.annotationBoundary(mapB);
m.characters("text");
m.annotationBoundary(mapC);
m.elementEnd();
assertReversible(makeBlipOp("annotationBoundary", m.build()));
}
示例8: testAnnotationNormalization1
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testAnnotationNormalization1() {
AnnotationsNormalizer<DocOp> normalizer =
new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS1);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS2);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS3);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS4);
normalizer.retain(1);
DocOp docOp = normalizer.finish();
DocOp expected = new DocOpBuilder()
.retain(1)
.annotationBoundary(ANNOTATIONS1)
.retain(1)
.annotationBoundary(ANNOTATIONS2)
.retain(1)
.annotationBoundary(ANNOTATIONS3)
.retain(1)
.annotationBoundary(ANNOTATIONS4)
.retain(1)
.build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
}
示例9: testAnnotationNormalization2
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testAnnotationNormalization2() {
AnnotationsNormalizer<DocOp> normalizer =
new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS1);
normalizer.annotationBoundary(ANNOTATIONS2);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS3);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS4);
normalizer.retain(1);
DocOp docOp = normalizer.finish();
DocOp expected = new DocOpBuilder()
.retain(1)
.annotationBoundary(ANNOTATIONS12)
.retain(1)
.annotationBoundary(ANNOTATIONS3)
.retain(1)
.annotationBoundary(ANNOTATIONS4)
.retain(1)
.build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
}
示例10: testAnnotationNormalization3
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testAnnotationNormalization3() {
AnnotationsNormalizer<DocOp> normalizer =
new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS1);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS2);
normalizer.annotationBoundary(ANNOTATIONS3);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS4);
normalizer.retain(1);
DocOp docOp = normalizer.finish();
DocOp expected = new DocOpBuilder()
.retain(1)
.annotationBoundary(ANNOTATIONS1)
.retain(1)
.annotationBoundary(ANNOTATIONS23)
.retain(1)
.annotationBoundary(ANNOTATIONS4)
.retain(1)
.build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
}
示例11: testAnnotationNormalization4
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testAnnotationNormalization4() {
AnnotationsNormalizer<DocOp> normalizer =
new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS1);
normalizer.annotationBoundary(ANNOTATIONS2);
normalizer.annotationBoundary(ANNOTATIONS3);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS4);
normalizer.retain(1);
DocOp docOp = normalizer.finish();
DocOp expected = new DocOpBuilder()
.retain(1)
.annotationBoundary(ANNOTATIONS123)
.retain(1)
.annotationBoundary(ANNOTATIONS4)
.retain(1)
.build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
}
示例12: testEmptyRetainNormalization
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testEmptyRetainNormalization() {
AnnotationsNormalizer<DocOp> normalizer =
new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS1);
normalizer.annotationBoundary(ANNOTATIONS2);
normalizer.retain(0);
normalizer.annotationBoundary(ANNOTATIONS3);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS4);
normalizer.retain(1);
DocOp docOp = normalizer.finish();
DocOp expected = new DocOpBuilder()
.retain(1)
.annotationBoundary(ANNOTATIONS123)
.retain(1)
.annotationBoundary(ANNOTATIONS4)
.retain(1)
.build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
}
示例13: testEmptyCharactersNormalization
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testEmptyCharactersNormalization() {
AnnotationsNormalizer<DocOp> normalizer =
new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS1);
normalizer.annotationBoundary(ANNOTATIONS2);
normalizer.characters("");
normalizer.annotationBoundary(ANNOTATIONS3);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS4);
normalizer.retain(1);
DocOp docOp = normalizer.finish();
DocOp expected = new DocOpBuilder()
.retain(1)
.annotationBoundary(ANNOTATIONS123)
.retain(1)
.annotationBoundary(ANNOTATIONS4)
.retain(1)
.build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
}
示例14: testEmptyDeleteCharactersNormalization
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testEmptyDeleteCharactersNormalization() {
AnnotationsNormalizer<DocOp> normalizer =
new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS1);
normalizer.annotationBoundary(ANNOTATIONS2);
normalizer.deleteCharacters("");
normalizer.annotationBoundary(ANNOTATIONS3);
normalizer.retain(1);
normalizer.annotationBoundary(ANNOTATIONS4);
normalizer.retain(1);
DocOp docOp = normalizer.finish();
DocOp expected = new DocOpBuilder()
.retain(1)
.annotationBoundary(ANNOTATIONS123)
.retain(1)
.annotationBoundary(ANNOTATIONS4)
.retain(1)
.build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
}
示例15: testSimpleMonotonicComposition
import org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder; //导入依赖的package包/类
public void testSimpleMonotonicComposition() {
DocOpCollector collector = new DocOpCollector();
DocOp a = new DocOpBuilder().characters("a").build();
DocOp b = new DocOpBuilder().retain(1).characters("b").build();
DocOp c = new DocOpBuilder().retain(2).characters("c").build();
DocOp d = new DocOpBuilder().retain(3).characters("d").build();
collector.add(a);
collector.add(b);
collector.add(c);
collector.add(d);
DocOp expected = new DocOpBuilder().characters("abcd").build();
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, collector.composeAll()));
}