本文整理汇总了Java中org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter类的典型用法代码示例。如果您正苦于以下问题:Java DocOpInverter类的具体用法?Java DocOpInverter怎么用?Java DocOpInverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocOpInverter类属于org.waveprotocol.wave.model.document.operation.algorithm包,在下文中一共展示了DocOpInverter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: leaveDraftMode
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
@Override
public void leaveDraftMode(boolean saveChanges) {
Preconditions.checkArgument(draftMode, "Editor is not in draft mode");
draftMode = false;
if (!content.getDraftOps().isEmpty()) {
if (saveChanges) {
for (DocOp o : content.getDraftOps()) {
innerOutputSink.consume(o);
}
content.getDraftOps().clear();
}
else {
DocOp inv = DocOpInverter.invert(Composer.compose(content.getDraftOps()));
content.getDraftOps().clear();
content.consume(inv);
}
}
}
示例2: restore
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
private void restore(Document doc) {
// No comment.
UncheckedDocOpBuffer builder = new UncheckedDocOpBuffer();
doc.toInitialization().apply(builder);
DocOp state = builder.finish();
DocOp erasure = DocOpInverter.invert(state);
DocOp restoration;
try {
restoration = Composer.compose(erasure, state);
} catch (OperationException e) {
// If the code above fails, then there is a bug in the operation code, not
// these tests. Fail with an exception, not with a JUnit fail().
throw new RuntimeException(e);
}
doc.hackConsume(Nindo.fromDocOp(restoration, false));
}
示例3: applyAndReturnReverse
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
@Override
public List<? extends BlipOperation> applyAndReturnReverse(final BlipData blip)
throws OperationException {
WaveletOperationContext reverseContext = createReverseContext(blip);
// Update metadata
UpdateContributorMethod reverseMethod = update(blip, method);
blip.getContent().consume(contentOp);
DocOp reverseContentOp = DocOpInverter.invert(contentOp);
BlipContentOperation reverseOp =
new BlipContentOperation(reverseContext, reverseContentOp, reverseMethod);
return Collections.singletonList(reverseOp);
}
示例4: reverse
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
@Override
public List<? extends BlipOperation> reverse(WaveletOperationContext reverseContext) throws OperationException {
UpdateContributorMethod reverseMethod = method.reverse();
DocOp reverseContentOp = DocOpInverter.invert(contentOp);
BlipContentOperation reverseOp =
new BlipContentOperation(reverseContext, reverseContentOp, reverseMethod);
return Collections.singletonList(reverseOp);
}
示例5: invert
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
@Override
public DocOp invert(DocOp operation) {
EvaluatingDocOpCursor<DocOp> inverter =
new DocOpInverter<DocOp>(new DocOpBuffer());
operation.apply(inverter);
return inverter.finish();
}
示例6: visitBlipContentOperation
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
@Override
public void visitBlipContentOperation(BlipContentOperation op) {
inverse = new BlipContentOperation(reverseContext, DocOpInverter.invert(op.getContentOp()));
}
示例7: getInverse
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
@Override
public CoreWaveletOperation getInverse() {
DocOpInverter<DocOp> inverse = new DocOpInverter<DocOp>(new DocOpBuffer());
operation.apply(inverse);
return new CoreWaveletDocumentOperation(documentId, inverse.finish());
}
示例8: invert
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
@Override
public DocOp invert(DocOp operation) {
return DocOpInverter.invert(operation);
}
示例9: invert
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
private static DocOpList invert(DocOpList docOpList) {
return new DocOpList.Singleton(DocOpInverter.invert(docOpList.composeAll()));
}
示例10: createErasureOp
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入依赖的package包/类
/** Creates an op that deletes the doc's current state. */
private DocOp createErasureOp() {
UncheckedDocOpBuffer builder = new UncheckedDocOpBuffer();
doc.toInitialization().apply(builder);
return DocOpInverter.invert(builder.finish());
}