本文整理汇总了Java中org.waveprotocol.wave.model.util.ValueUtils.notEqual方法的典型用法代码示例。如果您正苦于以下问题:Java ValueUtils.notEqual方法的具体用法?Java ValueUtils.notEqual怎么用?Java ValueUtils.notEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.waveprotocol.wave.model.util.ValueUtils
的用法示例。
在下文中一共展示了ValueUtils.notEqual方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startAnnotation
import org.waveprotocol.wave.model.util.ValueUtils; //导入方法依赖的package包/类
private void startAnnotation(Nindo.Builder builder, String annotationKey,
String annotationValue) {
Stack<String> annotationStack = startedAnnotations.get(annotationKey);
if (annotationStack == null) {
annotationStack = new Stack<String>();
startedAnnotations.put(annotationKey, annotationStack);
affectedKeys.add(annotationKey);
}
String current = annotationStack.isEmpty() ? null : annotationStack.peek();
// Avoid no-ops
if (ValueUtils.notEqual(annotationValue, current)) {
if (current == null && isDefaultValue(annotationKey, annotationValue)) {
// If the current annotation is the default, and the new annotation
// value is also the default, we don't need to set the annotation value
} else {
builder.startAnnotation(annotationKey, annotationValue);
}
}
annotationStack.push(annotationValue);
}
示例2: AttributesModified
import org.waveprotocol.wave.model.util.ValueUtils; //导入方法依赖的package包/类
public AttributesModified(E element, AttributesUpdate update) {
super(Type.ATTRIBUTES);
this.element = element;
HashMap<String, String> oldV = new HashMap<String, String>();
HashMap<String, String> newV = new HashMap<String, String>();
for (int i = 0; i < update.changeSize(); i++) {
String oldValue = update.getOldValue(i);
String newValue = update.getNewValue(i);
if (ValueUtils.notEqual(newValue, oldValue)) {
oldV.put(update.getChangeKey(i), oldValue);
newV.put(update.getChangeKey(i), newValue);
}
}
this.oldValues = Collections.unmodifiableMap(oldV);
this.newValues = Collections.unmodifiableMap(newV);
}
示例3: triggerOnAnchorChanged
import org.waveprotocol.wave.model.util.ValueUtils; //导入方法依赖的package包/类
private void triggerOnAnchorChanged(Anchor oldAnchor, Anchor newAnchor) {
if (ValueUtils.notEqual(oldAnchor, newAnchor)) {
for (AnchorListener l : anchorListeners) {
l.onAnchorChanged(oldAnchor, newAnchor);
}
}
}
示例4: endAnnotation
import org.waveprotocol.wave.model.util.ValueUtils; //导入方法依赖的package包/类
private void endAnnotation(Nindo.Builder builder, String annotationKey) {
Stack<String> annotationStack = startedAnnotations.get(annotationKey);
Preconditions.checkNotNull(annotationStack, "cannot end unstarted annotation");
String current = annotationStack.pop();
// If there are no more entries, and the current annotation is non-null.
if (annotationStack.isEmpty() && current != null) { // avoid no-ops
if (!isDefaultValue(annotationKey, current)) {
builder.endAnnotation(annotationKey);
}
// Conditionally null out certain keys if they are in a special list
if (defaultValueMap.containsKey(annotationKey)) {
builder.startAnnotation(annotationKey, defaultValueMap.get(annotationKey));
} else {
startedAnnotations.remove(annotationKey);
}
} else {
String nextAnnotation = annotationStack.peek();
if (ValueUtils.notEqual(current, nextAnnotation)) {
// There's another entry in the stack and it is different from the
// current-
// If the entry in the stack is the same as default, just end the annotation.
// Otherwise, start the next one.
if (isDefaultValue(annotationKey, nextAnnotation)) {
builder.endAnnotation(annotationKey);
} else {
builder.startAnnotation(annotationKey, nextAnnotation);
}
}
}
}
示例5: maybeTriggerOnValueChanged
import org.waveprotocol.wave.model.util.ValueUtils; //导入方法依赖的package包/类
private void maybeTriggerOnValueChanged(V oldValue, V newValue) {
if (ValueUtils.notEqual(oldValue, newValue)) {
for (Listener<? super V> l : listeners) {
l.onValueChanged(oldValue, newValue);
}
}
}
示例6: safeSet
import org.waveprotocol.wave.model.util.ValueUtils; //导入方法依赖的package包/类
/** Utility to set an annotation key if not already set, returns true if it is set. */
private boolean safeSet(Builder builder, String key, Object newValue, Object oldValue,
StringMap<String> changeCollector) {
String newString = newValue == null ? null : newValue.toString();
String oldString = oldValue == null ? null : oldValue.toString();
if (ValueUtils.notEqual(newString, oldString)) {
builder.startAnnotation(key, newString);
changeCollector.put(key, newString);
return true;
} else {
return false;
}
}