gnu.trove.TObjectHashingStrategy Java Examples
The following examples show how to use
gnu.trove.TObjectHashingStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiMap.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static <K, V> MultiMap<K, V> createSet(final TObjectHashingStrategy strategy) { return new MultiMap<K, V>() { @Nonnull @Override protected Collection<V> createCollection() { return new SmartHashSet<V>(); } @Nonnull @Override protected Collection<V> createEmptyCollection() { return Collections.emptySet(); } @Nonnull @Override protected Map<K, Collection<V>> createMap() { return new THashMap<K, Collection<V>>(strategy); } }; }
Example #2
Source File: ObjectStubTree.java From consulo with Apache License 2.0 | 5 votes |
@Override public void occurrence(@Nonnull final StubIndexKey indexKey, @Nonnull final Object value) { Map<Object, int[]> map = myResult.get(indexKey); if (map == null) { map = new THashMap<>((TObjectHashingStrategy<Object>)myHashingStrategyFunction.fun(indexKey)); myResult.put(indexKey, map); } int[] list = map.get(value); if (list == null) { map.put(value, new int[]{myStubIdx}); } else { int lastNonZero = ArrayUtil.lastIndexOfNot(list, 0); if (lastNonZero >= 0 && list[lastNonZero] == myStubIdx) { // second and subsequent occurrence calls for the same value are no op return; } int lastZero = lastNonZero + 1; if (lastZero == list.length) { list = ArrayUtil.realloc(list, Math.max(4, list.length << 1)); map.put(value, list); } list[lastZero] = myStubIdx; } }
Example #3
Source File: MultiMap.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static <K, V> MultiMap<K, V> create(@Nonnull final TObjectHashingStrategy<K> strategy) { return new MultiMap<K, V>() { @Nonnull @Override protected Map<K, Collection<V>> createMap() { return new THashMap<K, Collection<V>>(strategy); } }; }
Example #4
Source File: RefreshWorker.java From consulo with Apache License 2.0 | 5 votes |
private void processQueue(@Nonnull NewVirtualFileSystem fs, @Nonnull PersistentFS persistence) throws RefreshCancelledException { TObjectHashingStrategy<String> strategy = FilePathHashingStrategy.create(fs.isCaseSensitive()); next: while (!myRefreshQueue.isEmpty()) { VirtualDirectoryImpl dir = (VirtualDirectoryImpl)myRefreshQueue.pullFirst(); boolean fullSync = dir.allChildrenLoaded(), succeeded; do { myHelper.beginTransaction(); try { succeeded = fullSync ? fullDirRefresh(fs, persistence, strategy, dir) : partialDirRefresh(fs, persistence, strategy, dir); } catch (InvalidVirtualFileAccessException e) { myHelper.endTransaction(false); continue next; } myHelper.endTransaction(succeeded); if (!succeeded && LOG.isTraceEnabled()) LOG.trace("retry: " + dir); } while (!succeeded); if (myIsRecursive) { dir.markClean(); } } }
Example #5
Source File: ObjectIntHashMap.java From consulo with Apache License 2.0 | 4 votes |
public ObjectIntHashMap(int initialCapacity, @Nonnull TObjectHashingStrategy<K> strategy) { super(initialCapacity, strategy); }
Example #6
Source File: SmartHashSet.java From consulo with Apache License 2.0 | 4 votes |
public SmartHashSet(int initialCapacity, float loadFactor, TObjectHashingStrategy<T> strategy) { super(initialCapacity, loadFactor, strategy); }
Example #7
Source File: RefHashMap.java From consulo with Apache License 2.0 | 4 votes |
RefHashMap(@Nonnull final TObjectHashingStrategy<? super K> hashingStrategy) { this(4, 0.8f, hashingStrategy); }
Example #8
Source File: RefHashMap.java From consulo with Apache License 2.0 | 4 votes |
static <K> boolean keyEqual(K k1, K k2, TObjectHashingStrategy<? super K> strategy) { return k1 == k2 || strategy.equals(k1, k2); }
Example #9
Source File: FilePathHashingStrategy.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public static TObjectHashingStrategy<CharSequence> createForCharSequence() { return SystemInfo.isFileSystemCaseSensitive ? CharSequenceHashingStrategy.CASE_SENSITIVE : CharSequenceHashingStrategy.CASE_INSENSITIVE; }
Example #10
Source File: RefHashMap.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull protected abstract <T> Key<T> createKey(@Nonnull T k, @Nonnull TObjectHashingStrategy<? super T> strategy, @Nonnull ReferenceQueue<? super T> q);
Example #11
Source File: MultiMap.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public static <K, V> MultiMap<K, V> createSet() { return createSet(TObjectHashingStrategy.CANONICAL); }
Example #12
Source File: SoftValueHashMap.java From consulo with Apache License 2.0 | 4 votes |
SoftValueHashMap(@Nonnull TObjectHashingStrategy<K> strategy) { super(strategy); }
Example #13
Source File: FilePathHashingStrategy.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public static TObjectHashingStrategy<String> create() { return create(SystemInfo.isFileSystemCaseSensitive); }
Example #14
Source File: ObjectLongHashMap.java From consulo with Apache License 2.0 | 4 votes |
public ObjectLongHashMap(int initialCapacity, @Nonnull TObjectHashingStrategy<K> strategy) { super(initialCapacity, strategy); }
Example #15
Source File: Interner.java From consulo with Apache License 2.0 | 4 votes |
public Interner(@Nonnull TObjectHashingStrategy<T> strategy) { mySet = new OpenTHashSet<T>(strategy); }
Example #16
Source File: SmartHashSet.java From consulo with Apache License 2.0 | 4 votes |
public SmartHashSet(int initialCapacity, TObjectHashingStrategy<T> strategy) { super(initialCapacity, strategy); }
Example #17
Source File: SmartHashSet.java From consulo with Apache License 2.0 | 4 votes |
public SmartHashSet(int initialCapacity, float loadFactor, TObjectHashingStrategy<T> strategy) { super(initialCapacity, loadFactor, strategy); }
Example #18
Source File: SingletonSet.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull protected TObjectHashingStrategy<E> getStrategy() { return strategy; }
Example #19
Source File: ConcurrentRefHashMap.java From consulo with Apache License 2.0 | 4 votes |
ConcurrentRefHashMap(int initialCapacity, float loadFactor, int concurrencyLevel, @Nonnull TObjectHashingStrategy<? super K> hashingStrategy) { myHashingStrategy = hashingStrategy == THIS ? this : hashingStrategy; myMap = ContainerUtil.newConcurrentMap(initialCapacity, loadFactor, concurrencyLevel); }
Example #20
Source File: SoftArrayHashMap.java From consulo with Apache License 2.0 | 4 votes |
public SoftArrayHashMap(@Nonnull TObjectHashingStrategy<T> strategy) { myStrategy = strategy; }
Example #21
Source File: ContainerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Contract(pure = true) public static <K, V> ConcurrentMap<K, V> createConcurrentWeakMap(int initialCapacity, float loadFactor, int concurrencyLevel, @Nonnull TObjectHashingStrategy<K> hashingStrategy) { return Maps.newConcurrentWeakHashMap(initialCapacity, loadFactor, concurrencyLevel, hashingStrategy); }
Example #22
Source File: ContainerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Contract(pure = true) @Deprecated public static <K, V> ConcurrentMap<K, V> createConcurrentSoftMap(int initialCapacity, float loadFactor, int concurrencyLevel, @Nonnull TObjectHashingStrategy<K> hashingStrategy) { return Maps.newConcurrentSoftHashMap(initialCapacity, loadFactor, concurrencyLevel, hashingStrategy); }
Example #23
Source File: ContainerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Contract(pure = true) public static <K, V> ConcurrentMap<K, V> createConcurrentWeakKeyWeakValueMap(@Nonnull TObjectHashingStrategy<K> strategy) { //noinspection deprecation return new ConcurrentWeakKeyWeakValueHashMap<K, V>(100, 0.75f, Runtime.getRuntime().availableProcessors(), strategy); }
Example #24
Source File: ContainerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Contract(value = "_, _, _ -> new", pure = true) @Nonnull @Deprecated public static <K, V> Map<K, V> createWeakMap(int initialCapacity, float loadFactor, @Nonnull TObjectHashingStrategy<? super K> strategy) { return Maps.newWeakHashMap(initialCapacity, loadFactor, strategy); }
Example #25
Source File: ContainerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Contract(pure = true) @Deprecated public static <K, V> ConcurrentMap<K, V> createConcurrentWeakKeySoftValueMap(int initialCapacity, float loadFactor, int concurrencyLevel, @Nonnull final TObjectHashingStrategy<K> hashingStrategy) { return Maps.newConcurrentWeakKeySoftValueHashMap(initialCapacity, loadFactor, concurrencyLevel, hashingStrategy); }
Example #26
Source File: OpenTHashSet.java From consulo with Apache License 2.0 | 4 votes |
public OpenTHashSet(final int initialCapacity, final TObjectHashingStrategy<T> strategy) { super(initialCapacity, strategy); }
Example #27
Source File: ContainerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Contract(pure = true) @Deprecated public static <T> TObjectHashingStrategy<T> canonicalStrategy() { return ObjectHashingStrategies.canonicalStrategy(); }
Example #28
Source File: ContainerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Contract(pure = true) public static <K, V> ConcurrentMap<K, V> createConcurrentSoftKeySoftValueMap(int initialCapacity, float loadFactor, int concurrencyLevel, @Nonnull final TObjectHashingStrategy<K> hashingStrategy) { return new ConcurrentSoftKeySoftValueHashMap<K, V>(initialCapacity, loadFactor, concurrencyLevel, hashingStrategy); }
Example #29
Source File: Enumerator.java From consulo with Apache License 2.0 | 4 votes |
public Enumerator(int expectNumber, TObjectHashingStrategy<T> strategy) { myNumbers = new TObjectIntHashMap<T>(expectNumber, strategy); }
Example #30
Source File: OrderedSet.java From consulo with Apache License 2.0 | 4 votes |
public OrderedSet(@Nonnull TObjectHashingStrategy<T> hashingStrategy) { this(hashingStrategy, 4); }