本文整理汇总了Java中org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation.getBlipOp方法的典型用法代码示例。如果您正苦于以下问题:Java WaveletBlipOperation.getBlipOp方法的具体用法?Java WaveletBlipOperation.getBlipOp怎么用?Java WaveletBlipOperation.getBlipOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation
的用法示例。
在下文中一共展示了WaveletBlipOperation.getBlipOp方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AggregateOperation
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
/**
* Constructs an aggregate operation that has the same behaviour as a
* <code>WaveletBlipOperation</code>.
*
* @param op The wavelet blip operation.
*/
AggregateOperation(WaveletBlipOperation op) {
segmentsToRemove = Collections.emptyList();
segmentsToAdd = Collections.emptyList();
segmentsToEndModifying = Collections.emptyList();
segmentsToStartModifying = Collections.emptyList();
participantsToRemove = Collections.emptyList();
participantsToAdd = Collections.emptyList();
if (op.getBlipOp() instanceof BlipContentOperation) {
docOps = Collections.singletonList(
new DocumentOperations(
op.getBlipId(),
new DocOpList.Singleton(((BlipContentOperation) op.getBlipOp()).getContentOp())));
} else {
docOps = Collections.emptyList();
}
}
示例2: checkInsert
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的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.");
}
示例3: makeSegmentOperations
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
@Timed
static Map<SegmentId, SegmentOperation> makeSegmentOperations(WaveletDeltaRecord delta) {
LoadingCache<SegmentId, ImmutableList.Builder<WaveletOperation>> builders = CacheBuilder.newBuilder().build(
new CacheLoader<SegmentId, ImmutableList.Builder<WaveletOperation>>(){
@Override
public ImmutableList.Builder<WaveletOperation> load(SegmentId segmentId) {
return ImmutableList.builder();
}
});
Map<SegmentId, SegmentOperation> segmentOperations = CollectionUtils.newHashMap();
for (WaveletOperation op : delta.getTransformedDelta()) {
WaveletOperationContext newContext = makeSegmentContext(op.getContext(), delta.getResultingVersion().getVersion());
if (op instanceof AddParticipant) {
builders.getUnchecked(SegmentId.PARTICIPANTS_ID).add(
new AddParticipant(newContext, ((AddParticipant)op).getParticipantId()));
} else if (op instanceof RemoveParticipant) {
builders.getUnchecked(SegmentId.PARTICIPANTS_ID).add(
new RemoveParticipant(newContext, ((RemoveParticipant)op).getParticipantId()));
} else if (op instanceof NoOp) {
builders.getUnchecked(SegmentId.PARTICIPANTS_ID).add(new NoOp(newContext));
} else {
WaveletBlipOperation blipOp = (WaveletBlipOperation)op;
BlipContentOperation blipContentOp = (BlipContentOperation)blipOp.getBlipOp();
BlipContentOperation newBlipContentOp = new BlipContentOperation(newContext,
blipContentOp.getContentOp(), blipContentOp.getContributorMethod());
WaveletBlipOperation newBlipOp = new WaveletBlipOperation(blipOp.getBlipId(), newBlipContentOp);
builders.getUnchecked(SegmentId.ofBlipId(blipOp.getBlipId())).add(newBlipOp);
}
}
for (Entry<SegmentId, ImmutableList.Builder<WaveletOperation>> entry : builders.asMap().entrySet()) {
segmentOperations.put(entry.getKey(), new SegmentOperationImpl(entry.getValue().build()));
}
return segmentOperations;
}
示例4: prepareOperation
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
private void prepareOperation(WaveletOperation op) {
if (op instanceof AddParticipant) {
log(3, "AddParticipant " + ((AddParticipant)op).getParticipantId().toString());
} else if (op instanceof RemoveParticipant) {
log(3, "RemoveParticipant " + ((RemoveParticipant)op).getParticipantId().toString());
} else if (op instanceof WaveletBlipOperation) {
WaveletBlipOperation waveletBlipOp = (WaveletBlipOperation) op;
BlipOperation blipOp = waveletBlipOp.getBlipOp();
if (blipOp instanceof BlipContentOperation) {
DocOp docOp = ((BlipContentOperation) blipOp).getContentOp();
log(3, "BlipId=" + waveletBlipOp.getBlipId() + ", Op=" + operationToString(docOp) +
", OpSize=" + docOp.size());
}
}
}
示例5: serialize
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
public static DBObject serialize(WaveletOperation waveletOp) {
final BasicDBObject mongoOp = new BasicDBObject();
if (waveletOp instanceof NoOp) {
mongoOp.append(FIELD_TYPE, WAVELET_OP_NOOP);
} else if (waveletOp instanceof AddParticipant) {
mongoOp.append(FIELD_TYPE, WAVELET_OP_ADD_PARTICIPANT);
mongoOp.append(FIELD_PARTICIPANT, serialize(((AddParticipant) waveletOp).getParticipantId()));
} else if (waveletOp instanceof RemoveParticipant) {
mongoOp.append(FIELD_TYPE, WAVELET_OP_REMOVE_PARTICIPANT);
mongoOp.append(FIELD_PARTICIPANT,
serialize(((RemoveParticipant) waveletOp).getParticipantId()));
} else if (waveletOp instanceof WaveletBlipOperation) {
final WaveletBlipOperation waveletBlipOp = (WaveletBlipOperation) waveletOp;
mongoOp.append(FIELD_TYPE, WAVELET_OP_WAVELET_BLIP_OPERATION);
mongoOp.append(FIELD_BLIPID, waveletBlipOp.getBlipId());
if (waveletBlipOp.getBlipOp() instanceof BlipContentOperation) {
mongoOp.append(FIELD_BLIPOP, serialize((BlipContentOperation) waveletBlipOp.getBlipOp()));
} else {
throw new IllegalArgumentException("Unsupported blip operation: "
+ waveletBlipOp.getBlipOp());
}
} else {
throw new IllegalArgumentException("Unsupported wavelet operation: " + waveletOp);
}
return mongoOp;
}
示例6: serializeOperation
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
private void serializeOperation(WaveletOperation operation, ProtoWaveletOperation serialized) {
if (operation instanceof AddSegment) {
serialized.setAddSegment(
serializeOptionalSegmentId(((AddSegment)operation).getSegmentId()));
} else if (operation instanceof RemoveSegment) {
serialized.setRemoveSegment(
serializeOptionalSegmentId(((RemoveSegment)operation).getSegmentId()));
} else if (operation instanceof StartModifyingSegment) {
serialized.setStartModifyingSegment(
serializeOptionalSegmentId(((StartModifyingSegment)operation).getSegmentId()));
} else if (operation instanceof EndModifyingSegment) {
serialized.setEndModifyingSegment(
serializeOptionalSegmentId(((EndModifyingSegment)operation).getSegmentId()));
} else if (operation instanceof AddParticipant) {
serialized.setAddParticipant(((AddParticipant)operation).getParticipantId().getAddress());
} else if (operation instanceof RemoveParticipant) {
serialized.setRemoveParticipant(((RemoveParticipant)operation).getParticipantId().getAddress());
} else if (operation instanceof WaveletBlipOperation) {
WaveletBlipOperation waveletOp = (WaveletBlipOperation)operation;
BlipContentOperation blipOp = (BlipContentOperation)waveletOp.getBlipOp();
switch (blipOp.getContributorMethod()) {
case ADD:
serialized.setAddDocumentContributor(true);
break;
case REMOVE:
serialized.setRemoveDocumentContributor(true);
break;
}
serialized.setDocumentOperation(operationSerializer.serialize(blipOp.getContentOp()));
} else if (operation instanceof NoOp) {
serialized.setNoOp(true);
} else {
throw new RuntimeException("Bad operation type");
}
}
示例7: optimise
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
public void optimise() {
int startSize = size();
if (startSize == 1) {
return;
}
ArrayList<DocOp> docOps = CollectionUtils.newArrayList();
List<WaveletOperation> oldOperations = CollectionUtils.newArrayList(this);
String currentId = null;
WaveletOperationContext lastOperationContext = null;
this.clear();
for (WaveletOperation waveletOp : oldOperations) {
if (waveletOp instanceof WaveletBlipOperation) {
WaveletBlipOperation waveletBlipOp = ((WaveletBlipOperation) waveletOp);
String id = waveletBlipOp.getBlipId();
BlipOperation blipOp = waveletBlipOp.getBlipOp();
if (blipOp instanceof BlipContentOperation) {
if (!docOps.isEmpty() && !id.equals(currentId)) {
composeDocOps(this, currentId, lastOperationContext, docOps);
}
docOps.add(((BlipContentOperation) blipOp).getContentOp());
lastOperationContext = blipOp.getContext();
currentId = id;
continue;
}
}
if (!docOps.isEmpty()) {
composeDocOps(this, currentId, lastOperationContext, docOps);
}
add(waveletOp);
}
if (!docOps.isEmpty()) {
composeDocOps(this, currentId, lastOperationContext, docOps);
}
}
示例8: applyOperation
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
/**
* Applies the given operation to the doc.
*
* @param operation
* @throws OperationException
*/
private void applyOperation(WaveletOperation operation) throws OperationException {
if (operation instanceof WaveletBlipOperation) {
WaveletBlipOperation waveOp = (WaveletBlipOperation) operation;
if (waveOp.getBlipOp() instanceof BlipContentOperation) {
BlipContentOperation blipOp = (BlipContentOperation) waveOp.getBlipOp();
doc.consume(blipOp.getContentOp());
}
}
}
示例9: AggregateOperation
import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation; //导入方法依赖的package包/类
/**
* Constructs an aggregate operation that has the same behaviour as a
* <code>WaveletBlipOperation</code>.
*
* @param op The wavelet blip operation.
*/
AggregateOperation(WaveletBlipOperation op) {
participantsToRemove = Collections.emptyList();
participantsToAdd = Collections.emptyList();
if (op.getBlipOp() instanceof BlipContentOperation) {
docOps = Collections.singletonList(
new DocumentOperations(
op.getBlipId(),
new DocOpList.Singleton(((BlipContentOperation) op.getBlipOp()).getContentOp())));
} else {
docOps = Collections.emptyList();
}
}