本文整理汇总了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;
}
示例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);
}
}
}
示例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"));
}
示例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"));
}
示例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);
}
}
示例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;
}