本文整理汇总了Java中gnu.trove.TObjectObjectProcedure类的典型用法代码示例。如果您正苦于以下问题:Java TObjectObjectProcedure类的具体用法?Java TObjectObjectProcedure怎么用?Java TObjectObjectProcedure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TObjectObjectProcedure类属于gnu.trove包,在下文中一共展示了TObjectObjectProcedure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyTo
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
@NotNull
public KeymapImpl copyTo(@NotNull final KeymapImpl otherKeymap) {
otherKeymap.myParent = myParent;
otherKeymap.myName = myName;
otherKeymap.myCanModify = canModify();
otherKeymap.cleanShortcutsCache();
otherKeymap.myActionId2ListOfShortcuts.clear();
otherKeymap.myActionId2ListOfShortcuts.ensureCapacity(myActionId2ListOfShortcuts.size());
myActionId2ListOfShortcuts.forEachEntry(new TObjectObjectProcedure<String, OrderedSet<Shortcut>>() {
@Override
public boolean execute(String actionId, OrderedSet<Shortcut> shortcuts) {
otherKeymap.myActionId2ListOfShortcuts.put(actionId, new OrderedSet<Shortcut>(shortcuts));
return true;
}
});
return otherKeymap;
}
示例2: apply
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
@NotNull
public List<T> apply() {
final List<T> items = getItems();
if (!helper.hasModifiedItems()) {
return items;
}
helper.process(new TObjectObjectProcedure<T, T>() {
@Override
public boolean execute(T newItem, T oldItem) {
itemEditor.applyModifiedProperties(newItem, oldItem);
silentlyReplaceItem(newItem, oldItem, -1);
return true;
}
});
helper.reset(items);
return items;
}
示例3: selectItem
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
public void selectItem(@NotNull final T item) {
table.clearSelection();
final Ref<T> ref;
if (helper.hasModifiedItems()) {
ref = Ref.create();
helper.process(new TObjectObjectProcedure<T, T>() {
@Override
public boolean execute(T modified, T original) {
if (item == original) {
ref.set(modified);
}
return ref.isNull();
}
});
}
else {
ref = null;
}
table.addSelection(ref == null || ref.isNull() ? item : ref.get());
}
示例4: mapCopy
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
private THashMap<Value, Object> mapCopy(final THashMap<Value, Object> map) {
if (map == null) {
return null;
}
final THashMap<Value, Object> cloned = map.clone();
cloned.forEachEntry(new TObjectObjectProcedure<Value, Object>() {
@Override
public boolean execute(Value key, Object val) {
if (val instanceof ChangeBufferingList) {
cloned.put(key, ((ChangeBufferingList)val).clone());
}
return true;
}
});
return cloned;
}
示例5: getState
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
@Nullable
@Override
public State getState() {
synchronized (myStatus) {
// remove default entries
myStatus.retainEntries(new TObjectObjectProcedure<VirtualFile, Entry>() {
@Override
public boolean execute(VirtualFile file, Entry entry) {
return !(entry.status == Status.ACTIVE && entry.error == null);
}
});
if (myStatus.isEmpty()) {
return new State(Collections.<Entry>emptyList());
}
Entry[] entries = myStatus.values().toArray(new Entry[myStatus.size()]);
Arrays.sort(entries);
return new State(Arrays.asList(entries));
}
}
示例6: mapCopy
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
private THashMap<Value, Object> mapCopy(final THashMap<Value, Object> map) {
if (map == null) {
return null;
}
final THashMap<Value, Object> cloned = map.clone();
cloned.forEachEntry(new TObjectObjectProcedure<Value, Object>() {
@Override
public boolean execute(Value key, Object val) {
if (val instanceof TIntHashSet) {
cloned.put(key, ((TIntHashSet)val).clone());
}
return true;
}
});
return cloned;
}
示例7: selectItem
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
public void selectItem(@Nonnull final T item) {
table.clearSelection();
final Ref<T> ref;
if (helper.hasModifiedItems()) {
ref = Ref.create();
helper.process(new TObjectObjectProcedure<T, T>() {
@Override
public boolean execute(T modified, T original) {
if (item == original) {
ref.set(modified);
}
return ref.isNull();
}
});
}
else {
ref = null;
}
table.addSelection(ref == null || ref.isNull() ? item : ref.get());
}
示例8: processAllKeysAsDeleted
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
private void processAllKeysAsDeleted(final RemovedKeyProcessor<Key> removeProcessor) throws StorageException {
if (myMap instanceof THashMap) {
final StorageException[] exception = new StorageException[]{null};
((THashMap<Key, Value>)myMap).forEachEntry(new TObjectObjectProcedure<Key, Value>() {
@Override
public boolean execute(Key k, Value v) {
try {
removeProcessor.process(k, myInputId);
}
catch (StorageException e) {
exception[0] = e;
return false;
}
return true;
}
});
if (exception[0] != null) throw exception[0];
}
else {
for (Key key : myMap.keySet()) {
removeProcessor.process(key, myInputId);
}
}
}
示例9: putAll
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
@Override
public void putAll(ObjectObjectMultiMaplet<K, V> m) {
m.forEachEntry(new TObjectObjectProcedure<K, Collection<V>>() {
@Override
public boolean execute(K key, Collection<V> value) {
put(key, value);
return true;
}
});
}
示例10: replaceAll
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
@Override
public void replaceAll(ObjectObjectMultiMaplet<K, V> m) {
m.forEachEntry(new TObjectObjectProcedure<K, Collection<V>>() {
@Override
public boolean execute(K key, Collection<V> value) {
replace(key, value);
return true;
}
});
}
示例11: correctPasswords
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
private void correctPasswords(@NotNull HttpConfigurable to) {
synchronized (myLock) {
to.myGenericPasswords.retainEntries(new TObjectObjectProcedure<CommonProxy.HostInfo, ProxyInfo>() {
@Override
public boolean execute(CommonProxy.HostInfo hostInfo, ProxyInfo proxyInfo) {
return proxyInfo.isStore();
}
});
}
}
示例12: processModifiedItems
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
public void processModifiedItems(@NotNull final PairProcessor<T, T> processor) {
// don't want to expose TObjectObjectProcedure - avoid implementation details
helper.process(new TObjectObjectProcedure<T, T>() {
@Override
public boolean execute(T newItem, T oldItem) {
return processor.process(newItem, oldItem);
}
});
}
示例13: apply
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
@NotNull
public List<T> apply() {
if (helper.hasModifiedItems()) {
@SuppressWarnings("unchecked")
final ColumnInfo<T, Object>[] columns = model.getColumnInfos();
helper.process(new TObjectObjectProcedure<T, T>() {
@Override
public boolean execute(T newItem, @NotNull T oldItem) {
for (ColumnInfo<T, Object> column : columns) {
if (column.isCellEditable(newItem)) {
column.setValue(oldItem, column.valueOf(newItem));
}
}
if (itemEditor instanceof DialogItemEditor) {
((DialogItemEditor<T>)itemEditor).applyEdited(oldItem, newItem);
}
model.items.set(ContainerUtil.indexOfIdentity(model.items, newItem), oldItem);
return true;
}
});
}
helper.reset(model.items);
return model.items;
}
示例14: copy
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
@NotNull
public ValueContainerImpl<Value> copy() {
ValueContainerImpl<Value> container = new ValueContainerImpl<Value>();
if (myInputIdMapping instanceof THashMap) {
final THashMap<Value, Object> mapping = (THashMap<Value, Object>)myInputIdMapping;
final THashMap<Value, Object> newMapping = new THashMap<Value, Object>(mapping.size());
container.myInputIdMapping = newMapping;
mapping.forEachEntry(new TObjectObjectProcedure<Value, Object>() {
@Override
public boolean execute(Value key, Object val) {
if (val instanceof ChangeBufferingList) {
newMapping.put(key, ((ChangeBufferingList)val).clone());
} else {
newMapping.put(key, val);
}
return true;
}
});
} else {
container.myInputIdMapping = myInputIdMapping;
container.myInputIdMappingValue = myInputIdMappingValue instanceof ChangeBufferingList ?
((ChangeBufferingList)myInputIdMappingValue).clone():
myInputIdMappingValue;
}
return container;
}
示例15: iterateAddedKeyAndValues
import gnu.trove.TObjectObjectProcedure; //导入依赖的package包/类
public static <Key, Value> void iterateAddedKeyAndValues(final int inputId,
final AddedKeyProcessor<Key, Value> consumer,
Map<Key, Value> data) throws StorageException {
if (data instanceof THashMap) {
// such map often (from IdIndex) contain 100x (avg ~240) of entries, also THashMap have no Entry inside so we optimize for gc too
final Ref<StorageException> exceptionRef = new Ref<StorageException>();
final boolean b = ((THashMap<Key, Value>)data).forEachEntry(new TObjectObjectProcedure<Key, Value>() {
@Override
public boolean execute(Key key, Value value) {
try {
consumer.process(key, value, inputId);
}
catch (StorageException ex) {
exceptionRef.set(ex);
return false;
}
return true;
}
});
if (!b) throw exceptionRef.get();
}
else {
for (Map.Entry<Key, Value> entry : data.entrySet()) {
consumer.process(entry.getKey(), entry.getValue(), inputId);
}
}
}