本文整理匯總了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);
}