当前位置: 首页>>代码示例>>Java>>正文


Java ValueUtils类代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.util.ValueUtils的典型用法代码示例。如果您正苦于以下问题:Java ValueUtils类的具体用法?Java ValueUtils怎么用?Java ValueUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ValueUtils类属于org.waveprotocol.wave.model.util包,在下文中一共展示了ValueUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equals

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  DigestSnapshot other = (DigestSnapshot) obj;
  return waveId.equals(other.waveId) //
      && ValueUtils.equal(author, other.author) //
      && participants.equals(other.participants) //
      && ValueUtils.equal(title, other.title) //
      && ValueUtils.equal(snippet, other.snippet) //
      && blipCount == other.blipCount //
      && unreadCount == other.unreadCount //
      && lastModified == other.lastModified;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:SearchService.java

示例2: UrlParameters

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
UrlParameters(String query) {
  if (query.length() > 1) {
    String[] keyvalpairs = query.substring(1, query.length()).split("&");
    for (String pair : keyvalpairs) {
      String[] keyval = pair.split("=");
      // Some basic error handling for invalid query params.
      String paramUnderlineName = URL.decodeQueryString(keyval[0]);
      String paramCamelName = ValueUtils.toCamelCase(paramUnderlineName, "_", false);
      String key = FlagConstants.getShortName(paramCamelName);
      if (keyval.length == 2) {
        String value = URL.decodeQueryString(keyval[1]);
        map.put(key, value);
      } else if (keyval.length == 1) {
        map.put(key, "");
      }
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:19,代码来源:UrlParameters.java

示例3: presentThread

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
/**
 * Represents the given conversation thread to the string builder.
 * 
 * @param thread the given conversation thread
 * @param level tree level of the conversation thread
 * @param builder string builder
 */    
protected void presentThread(ConversationThread thread, int level, StringBuilder builder) {
  if (level > 0) {
    builder.append("\n");
  }
  builder.append(ValueUtils.stringFromChar(' ', level));
  openBracket(builder);
  presentThreadStart(thread, level, builder);
  closeBracket(builder);

  for (ConversationBlip blip : thread.getBlips()) {
    presentBlip(blip, level == 0 ? 0 : level + 1, builder);
  }

  openBracket(builder);
  presentThreadFinish(thread, level, builder);
  closeBracket(builder);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:25,代码来源:ConversationPresenterImpl.java

示例4: presentBlip

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
/**
 * Represents the given conversation blip to the string builder.
 * 
 * @param blip the given conversation thread
 * @param level tree level of the conversation blip
 * @param builder string builder
 */    
protected void presentBlip(ConversationBlip blip, int level, StringBuilder builder) {
  builder.append("\n");
  builder.append(ValueUtils.stringFromChar(' ', level));
  openBracket(builder);
  presentBlipStart(blip, level, builder);
  closeBracket(builder);

  for (ConversationBlip.LocatedReplyThread<? extends ConversationThread> locatedReply :
      blip.locateReplyThreads()) {
    presentThread(locatedReply.getThread(), level + 1, builder);
  }

  openBracket(builder);
  presentBlipFinish(blip, level, builder);
  closeBracket(builder);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:24,代码来源:ConversationPresenterImpl.java

示例5: 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);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:RichTextMutationBuilder.java

示例6: 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);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:19,代码来源:DocumentEvent.java

示例7: checkElement

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
/**
 * Checks whether the current walk is the correct type of element.
 * @throws IllegalStateException if the element does not match the expected state.
 * @return the checked element.
 */
public E checkElement(String tagName, Map<String, String> attributes) {
  Preconditions.checkState(nodeWalker.hasNext(),
      "Tree Walker: no more nodes to walk, element expected");

  progress();

  E element = document.asElement(currentNode);

  Preconditions.checkState(element != null,
      "Tree Walker: At text node, element expected");
  Preconditions.checkState(document.getTagName(element).equals(tagName),
      "Tree Walker: Incorrect tag name");
  Preconditions.checkState(ValueUtils.equal(document.getAttributes(element), attributes),
      "Tree Walker: Incorrect attributes");

  return element;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:23,代码来源:ReadableTreeWalker.java

示例8: supplementAnnotations

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
/**
 * Given the editor state, this examines the current caret annotations and adds any that
 * can be inferred from the position, given the alignment type.
 *
 * @param doc Document to check for annotations.
 * @param caret Current annotation styles at the caret.
 * @param keys Keys to supplement over the caret styles.
 * @param location Location of the caret in the document.
 * @param leftAlign Whether the annotations come from the left or right.
 */
public static void supplementAnnotations(final MutableAnnotationSet<String> doc,
    final CaretAnnotations caret, final ReadableStringSet keys, final int location,
    final boolean leftAlign) {
  // by default, everything inherits from the left, so for now, no need!
  if (leftAlign) {
    return;
  }

  // supplement anything that's missing and different:
  keys.each(new Proc() {
    @Override
    public void apply(String key) {
      if (!caret.hasAnnotation(key)) {
        String newValue = Annotations.getAlignedAnnotation(doc, location, key, leftAlign);
        String oldValue = doc.getAnnotation(location - 1, key);
        if (!ValueUtils.equal(newValue, oldValue)) {
          caret.setAnnotation(key, newValue);
        }
      }
    }
  });
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:33,代码来源:EditorAnnotationUtil.java

示例9: select

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
/**
 * Sets the selected focusable.
 *
 * @param focusable focusable to select
 */
public void select(Focusable focusable) {
  Preconditions.checkArgument(focusable == null || focusOrder.contains(focusable));
  if (ValueUtils.equal(selected, focusable)) {
    // No-op.
    return;
  }

  if (focused && selected != null) {
    selected.onBlur();
  }
  selected = focusable;
  if (focused && selected != null) {
    selected.onFocus();
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:FocusManager.java

示例10: deltasAreEqual

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
public static boolean deltasAreEqual(WaveletDelta delta1, WaveletDelta delta2) {
  if (delta1 == delta2) {
    return true;
  }
  if (delta1 == null || delta2 == null) {
    return false;
  }
  if (delta1.size() != delta2.size()) {
    return false;
  }
  if (!ValueUtils.equal(delta1.getTargetVersion(), delta2.getTargetVersion())) {
    return false;
  }
  for (int i = 0; i < delta1.size(); ++i) {
    if (!delta1.get(i).equals(delta2.get(i))) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:CcTestingUtils.java

示例11: annotationBoundary

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
@Override
public void annotationBoundary(AnnotationBoundaryMap map) {
  for (int i = 0; i < map.changeSize(); i++) {
    String key = map.getChangeKey(i);
    String oldValue = map.getOldValue(i);
    String newValue = map.getNewValue(i);
    if (!ValueUtils.equal(oldValue, newValue) &&
        !key.startsWith(AnnotationConstants.USER_PREFIX) &&
        !key.startsWith(AnnotationConstants.SPELLY_PREFIX) &&
        !key.startsWith(AnnotationConstants.LINK_PREFIX) &&
        !key.startsWith(AnnotationConstants.ROSY_PREFIX) &&
        !key.startsWith(AnnotationConstants.LANGUAGE_PREFIX)) {
      throw TRUE;
    }
  }
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:17,代码来源:WorthyChangeChecker.java

示例12: focus

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
/**
 * Sets the blip that has the focus frame. If {@code blip} is null, the focus
 * frame is removed.
 */
private void focus(BlipView blip, boolean scroll) {
  if (!ValueUtils.equal(this.blip, blip)) {
    BlipView oldUi = this.blip;
    BlipView newUi = blip;

    // Scroll first, before layout gets invalidated.
    if (newUi != null && scroll) {
      scroller.moveTo(newUi);
    }

    detachChrome();
    this.blip = blip;
    attachChrome();

    fireOnFocusMoved(oldUi, newUi);
  }
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:22,代码来源:FocusFramePresenter.java

示例13: equals

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof WaveRef)) {
    return false;
  }
  WaveRef other = (WaveRef) obj;

  return (ValueUtils.equal(waveId, other.getWaveId()) &&
      ValueUtils.equal(waveletId, other.getWaveletId()) &&
      ValueUtils.equal(documentId, other.getDocumentId()));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:15,代码来源:WaveRef.java

示例14: 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);
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:8,代码来源:WaveletBasedConversation.java

示例15: annotationBoundary

import org.waveprotocol.wave.model.util.ValueUtils; //导入依赖的package包/类
@Override
public void annotationBoundary(AnnotationBoundaryMap map) {
  for (int i = 0; i < map.changeSize(); i++) {
    String key = map.getChangeKey(i);
    String oldValue = map.getOldValue(i);
    String newValue = map.getNewValue(i);
    if (!ValueUtils.equal(oldValue, newValue) &&
        !key.startsWith(AnnotationConstants.USER_PREFIX) &&
        !key.startsWith(AnnotationConstants.SPELLY_PREFIX) &&
        !key.startsWith(AnnotationConstants.ROSY_PREFIX) &&
        !key.startsWith(AnnotationConstants.LANGUAGE_PREFIX)) {
      throw TRUE;
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:16,代码来源:WorthyChangeChecker.java


注:本文中的org.waveprotocol.wave.model.util.ValueUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。