本文整理汇总了Java中org.waveprotocol.wave.model.util.StringSet类的典型用法代码示例。如果您正苦于以下问题:Java StringSet类的具体用法?Java StringSet怎么用?Java StringSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringSet类属于org.waveprotocol.wave.model.util包,在下文中一共展示了StringSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanupKnownKeys
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
public void cleanupKnownKeys() {
knownKeys.filter(
new StringSet.StringPredicate() {
@Override
public boolean apply(String key) {
if (root().localMap.containsKey(key)
&& root().localMap.getExisting(key) == null) {
root().localMap.remove(key);
return false;
} else {
return true;
}
}
});
}
示例2: 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;
}
示例3: 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);
}
}
}
示例4: copyInto
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
private void copyInto(final ToolbarButtonView display) {
if (state != null) {
display.setState(state);
}
if (text != null) {
display.setText(text);
}
if (tooltip != null) {
display.setTooltip(tooltip);
}
if (element != null) {
display.setVisualElement(element);
}
if (showDropdownArrow != null) {
display.setShowDropdownArrow(showDropdownArrow);
}
if (showDivider != null) {
display.setShowDivider(showDivider);
}
dcs.each(new StringSet.Proc() {
@Override
public void apply(String dc) {
display.addDebugClass(dc);
}
});
}
示例5: 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"));
}
示例6: 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"));
}
示例7: checkSentinels
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
private void checkSentinels() {
checkState(!sentinel.isRed());
checkState(sentinel.right.isLeaf());
checkState(sentinel.right.subtreeLength == 0);
checkState(sentinel.localMap.isEmpty());
checkState(sentinel.subtreeLength == -1);
// Check that position 0 exists and has only annotations with the value null.
checkState(root().subtreeLength >= 1);
knownKeys.each(new StringSet.Proc() {
@Override
public void apply(String key) {
checkState(ValueUtils.equal(getAnnotationRaw(0, key), null));
}
});
}
示例8: checkKnownKeysSetEverywhere
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
private void checkKnownKeysSetEverywhere() {
knownKeys.each(new StringSet.Proc() {
@Override
public void apply(String key) {
root().checkKeyCoverage(key);
}
});
}
示例9: 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);
}
}
示例10: permitsAttribute
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
@Override
public boolean permitsAttribute(String type, String attr, String value) {
checkNotTopLevel(type);
StringMap<StringSet> attrs = permittedAttrs.get(type);
return attrs != null && attrs.containsKey(attr) &&
(attrs.get(attr) == null || attrs.get(attr).contains(value));
}
示例11: permitsChild
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
@Override
public boolean permitsChild(String parentType, String childType) {
parentType = fixType(parentType);
checkNotTopLevel(childType);
StringSet permitted = permittedChildren.get(parentType);
return permitted != null && permitted.contains(childType);
}
示例12: registerEventHandler
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
/**
* Registers a listener for multiple browser events in one go
*
* @param el element to listen on
* @param eventNames set of events
* @param listener
* @return a reference set to be used for unregistering the handler for all
* events in one go
*/
public static HandlerReferenceSet registerEventHandler(final Element el,
ReadableStringSet eventNames, final JavaScriptEventListener listener) {
Preconditions.checkArgument(!eventNames.isEmpty(), "registerEventHandler: Event set is empty");
final HandlerReferenceSet referenceSet = new HandlerReferenceSet();
eventNames.each(new StringSet.Proc() {
@Override
public void apply(String eventName) {
referenceSet.references.add(registerEventHandler(el, eventName, listener));
}
});
return referenceSet;
}
示例13: 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;
}
示例14: filterContentAnnotations
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
/**
* Given a set of keys, return a subset that starts with prefixes in the
* whitelist.
*
* @param known
*/
private ReadableStringSet filterContentAnnotations(ReadableStringSet known) {
final StringSet interested = CollectionUtils.createStringSet();
known.each(new Proc() {
@Override
public void apply(final String key) {
AnnotationBehaviour behaviour = annotationLogic.getClosestBehaviour(key);
if (behaviour != null && behaviour.getAnnotationFamily() == AnnotationFamily.CONTENT) {
interested.add(key);
}
}
});
return interested;
}
示例15: cleanupKnownKeys
import org.waveprotocol.wave.model.util.StringSet; //导入依赖的package包/类
public void cleanupKnownKeys() {
knownKeys.filter(new StringSet.StringPredicate() {
@Override
public boolean apply(String key) {
if (root().localMap.containsKey(key)
&& root().localMap.getExisting(key) == null) {
root().localMap.remove(key);
return false;
} else {
return true;
}
}
});
}