本文整理汇总了Java中org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter.invert方法的典型用法代码示例。如果您正苦于以下问题:Java DocOpInverter.invert方法的具体用法?Java DocOpInverter.invert怎么用?Java DocOpInverter.invert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter
的用法示例。
在下文中一共展示了DocOpInverter.invert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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()));
}
示例6: invert
import org.waveprotocol.wave.model.document.operation.algorithm.DocOpInverter; //导入方法依赖的package包/类
@Override
public DocOp invert(DocOp operation) {
return DocOpInverter.invert(operation);
}
示例7: 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()));
}
示例8: 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());
}