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


Java StringSet.add方法代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.util.StringSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java StringSet.add方法的具体用法?Java StringSet.add怎么用?Java StringSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.waveprotocol.wave.model.util.StringSet的用法示例。


在下文中一共展示了StringSet.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nextLocation

import org.waveprotocol.wave.model.util.StringSet; //导入方法依赖的package包/类
@Override
public ReadableStringSet nextLocation() {
  if (!hasNext()) {
    throw new NoSuchElementException();
  }

  StringSet currentKeys = CollectionUtils.createStringSet();

  currentLocation = locations.peek().location;

  do {
    KeyLocation keyLocation = locations.remove();
    currentKeys.add(keyLocation.key);
    advance(keyLocation);
  } while (!locations.isEmpty() && locations.peek().location == currentLocation);

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

示例2: addAttrWithValues

import org.waveprotocol.wave.model.util.StringSet; //导入方法依赖的package包/类
public void addAttrWithValues(String type, String attrName, String ... permittedValues) {
  checkNotTopLevel(type);
  StringMap<StringSet> attrs = permittedAttrs.get(type);
  if (attrs == null) {
    permittedAttrs.put(type, attrs = CollectionUtils.createStringMap());
  }

  if (permittedValues.length == 0) {
    attrs.put(attrName, null);
  } else {
    StringSet values = attrs.get(attrName);
    if (values == null) {
      attrs.put(attrName, values = CollectionUtils.createStringSet());
    }

    for (String value : permittedValues) {
      values.add(value);
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:AbstractXmlSchemaConstraints.java

示例3: testUnstripKeys

import org.waveprotocol.wave.model.util.StringSet; //导入方法依赖的package包/类
public void testUnstripKeys() {
  useDocument("<line/>abcd", "link:L:4:6", "spell:S:5:7");
  PasteAnnotationLogic<Node, Element, Text> logic = initDefault();
  final StringSet ended = CollectionUtils.createStringSet();
  Nindo.Builder builder = new Nindo.Builder() {
    @Override public void endAnnotation(String key) {
      ended.add(key);
    }
  };

  ReadableStringSet keyCheck = CollectionUtils.newStringSet("A", "B", "C");
  ReadableStringSet toIgnore = CollectionUtils.newStringSet("B", "D");
  logic.unstripKeys(builder, keyCheck, toIgnore);

  assertEquals(2, ended.countEntries());
  assertTrue(ended.contains("A"));
  assertFalse(ended.contains("B"));
  assertTrue(ended.contains("C"));
  assertFalse(ended.contains("D"));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:PasteAnnotationLogicTest.java

示例4: testSupplementAnnotationsRightAligned

import org.waveprotocol.wave.model.util.StringSet; //导入方法依赖的package包/类
/** Check whether caret annotations are applied correctly. */
public void testSupplementAnnotationsRightAligned() {
  // NOTE(patcoleman): currently, nothing happens on supplementing annotations from the left, as
  //   the behaviour of annotations is to do this anyway. If this behaviour changes, a test
  //   should be added to test left-alignment too.
  useDocument("howdy", "A:a:5:7", "X:x:2:8");
  useCaretAnnotations("X:?", "Y:y");

  // caret annotation already exists, don't supplement:
  StringSet keys = CollectionUtils.createStringSet();
  keys.add("X");
  supplementAnnotations(doc, caret, keys, 5, false);
  assertTrue(caret.hasAnnotation("X"));
  assertEquals("?", caret.getAnnotation("X")); // keeps the caret annotation
  assertTrue(caret.hasAnnotation("Y"));

  // subset of annotations are supplemented, make sure new value is right:
  caret.removeAnnotation("X");
  keys.add("A");
  supplementAnnotations(doc, caret, keys, 5, false);
  assertFalse(caret.hasAnnotation("X"));
  assertTrue(caret.hasAnnotation("A"));
  assertEquals("a", caret.getAnnotation("A"));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:25,代码来源:EditorAnnotationUtilTest.java

示例5: addChildren

import org.waveprotocol.wave.model.util.StringSet; //导入方法依赖的package包/类
public void addChildren(String parentType, String ... childTypes) {
  parentType = fixType(parentType);
  StringSet permitted = permittedChildren.get(parentType);
  if (permitted == null) {
    permittedChildren.put(parentType, permitted = CollectionUtils.createStringSet());
  }
  for (String childType : childTypes) {
    checkNotTopLevel(childType);
    permitted.add(childType);
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:12,代码来源:AbstractXmlSchemaConstraints.java

示例6: debugGetAllUpdateEventNames

import org.waveprotocol.wave.model.util.StringSet; //导入方法依赖的package包/类
/**
 * Gets the class names of all registered event listeners. For debugging only.
 *
 * @return a new string set each time, containing the class names of all
 *         registered update event listeners. it is safe to modify this set.
 */
public StringSet debugGetAllUpdateEventNames() {
  StringSet events = CollectionUtils.createStringSet();
  for (EditorUpdateEvent.EditorUpdateListener l : updateListeners) {
    events.add(l.getClass().getName());
  }
  return events;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:14,代码来源:EditorUpdateEventImpl.java


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