本文整理汇总了Java中org.waveprotocol.wave.model.document.operation.util.ImmutableUpdateMap.AttributeUpdate类的典型用法代码示例。如果您正苦于以下问题:Java AttributeUpdate类的具体用法?Java AttributeUpdate怎么用?Java AttributeUpdate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AttributeUpdate类属于org.waveprotocol.wave.model.document.operation.util.ImmutableUpdateMap包,在下文中一共展示了AttributeUpdate类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAttributesUpdateImpl
import org.waveprotocol.wave.model.document.operation.util.ImmutableUpdateMap.AttributeUpdate; //导入依赖的package包/类
private AttributesUpdate createAttributesUpdateImpl(List<AttributeUpdate> sortedUpdates) {
try {
if (checkAttributes) {
return AttributesUpdateImpl.fromSortedUpdates(sortedUpdates);
} else {
return AttributesUpdateImpl.fromSortedUpdatesUnchecked(sortedUpdates);
}
} catch (IllegalArgumentException e) {
throw new DelayedInvalidInputException("Invalid attributes update: " + e, e);
}
}
示例2: attributesUpdateFrom
import org.waveprotocol.wave.model.document.operation.util.ImmutableUpdateMap.AttributeUpdate; //导入依赖的package包/类
private AttributesUpdate attributesUpdateFrom(UpdateAttributes message) {
List<AttributeUpdate> updates = new ArrayList<AttributeUpdate>();
for (int i = 0; i < message.getAttributeUpdateSize(); i++) {
KeyValueUpdate p = message.getAttributeUpdate(i);
updates.add(new AttributeUpdate(p.getKey(), p.hasOldValue() ? p.getOldValue() : null,
p.hasNewValue() ? p.getNewValue() : null));
}
return createAttributesUpdateImpl(updates);
}
示例3: updateWith
import org.waveprotocol.wave.model.document.operation.util.ImmutableUpdateMap.AttributeUpdate; //导入依赖的package包/类
private T updateWith(U attributeUpdate, boolean checkCompatibility) {
List<Attribute> newImmutableStateMap = new ArrayList<Attribute>();
Iterator<Attribute> iterator = attributes.iterator();
Attribute nextAttribute = iterator.hasNext() ? iterator.next() : null;
// TODO: Have a slow path when the cast would fail.
List<AttributeUpdate> updates = ((ImmutableUpdateMap<?,?>) attributeUpdate).updates;
for (AttributeUpdate update : updates) {
while (nextAttribute != null) {
int comparison = update.name.compareTo(nextAttribute.name);
if (comparison > 0) {
newImmutableStateMap.add(nextAttribute);
nextAttribute = iterator.hasNext() ? iterator.next() : null;
} else if (comparison < 0) {
if (checkCompatibility && update.oldValue != null) {
Preconditions.illegalArgument(
"Mismatched old value: attempt to update unset attribute with " + update);
}
break;
} else if (comparison == 0) {
if (checkCompatibility && !nextAttribute.value.equals(update.oldValue)) {
Preconditions.illegalArgument(
"Mismatched old value: attempt to update " + nextAttribute + " with " + update);
}
nextAttribute = iterator.hasNext() ? iterator.next() : null;
break;
}
}
if (update.newValue != null) {
newImmutableStateMap.add(new Attribute(update.name, update.newValue));
}
}
if (nextAttribute != null) {
newImmutableStateMap.add(nextAttribute);
while (iterator.hasNext()) {
newImmutableStateMap.add(iterator.next());
}
}
return createFromList(newImmutableStateMap);
}
示例4: scrubAttributesUpdate
import org.waveprotocol.wave.model.document.operation.util.ImmutableUpdateMap.AttributeUpdate; //导入依赖的package包/类
public static AttributesUpdate scrubAttributesUpdate(AttributesUpdate unscrubbed,
ScrubCache nameScrubber) {
List<AttributeUpdate> list = new ArrayList<AttributeUpdate>();
for (int i = 0; i < unscrubbed.changeSize(); i++) {
list.add(new AttributeUpdate(
nameScrubber.scrubUniquely(unscrubbed.getChangeKey(i)),
scrubMostString(unscrubbed.getOldValue(i)),
scrubMostString(unscrubbed.getNewValue(i))));
}
return AttributesUpdateImpl.fromUnsortedUpdatesUnchecked(list);
}