Package io.deephaven.base.string.cache
Class OpenAddressedWeakUnboundedStringCache<STRING_LIKE_TYPE extends CharSequence>
java.lang.Object
io.deephaven.base.string.cache.OpenAddressedWeakUnboundedStringCache<STRING_LIKE_TYPE>
- All Implemented Interfaces:
StringCache<STRING_LIKE_TYPE>
public class OpenAddressedWeakUnboundedStringCache<STRING_LIKE_TYPE extends CharSequence>
extends Object
implements StringCache<STRING_LIKE_TYPE>
Unbounded StringCache built around a OpenAddressedCanonicalizationCache, which only enforces weak reachability on its
STRING_LIKE_TYPE members.
-
Field Summary
Fields inherited from interface io.deephaven.base.string.cache.StringCache
CAPACITY_UNBOUNDED
-
Constructor Summary
ConstructorDescriptionOpenAddressedWeakUnboundedStringCache
(@NotNull StringCacheTypeAdapter<STRING_LIKE_TYPE> typeAdapter, int initialCapacity) OpenAddressedWeakUnboundedStringCache
(@NotNull StringCacheTypeAdapter<STRING_LIKE_TYPE> typeAdapter, @NotNull OpenAddressedCanonicalizationCache cache) -
Method Summary
Modifier and TypeMethodDescriptionfinal int
capacity()
Get a hint about this cache's capacity and behavior.final STRING_LIKE_TYPE
getCachedString
(@NotNull StringCompatible protoString) final STRING_LIKE_TYPE
getCachedString
(@NotNull String string) final STRING_LIKE_TYPE
final @NotNull Class<STRING_LIKE_TYPE>
getType()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.base.string.cache.StringCache
getCachedString
-
Constructor Details
-
OpenAddressedWeakUnboundedStringCache
public OpenAddressedWeakUnboundedStringCache(@NotNull @NotNull StringCacheTypeAdapter<STRING_LIKE_TYPE> typeAdapter, int initialCapacity) - Parameters:
typeAdapter
- The type adapter for this cacheinitialCapacity
- Initial capacity of the map backing this cache
-
OpenAddressedWeakUnboundedStringCache
public OpenAddressedWeakUnboundedStringCache(@NotNull @NotNull StringCacheTypeAdapter<STRING_LIKE_TYPE> typeAdapter, @NotNull @NotNull OpenAddressedCanonicalizationCache cache) - Parameters:
typeAdapter
- The type adapter for this String cachecache
- The internal canonicalization cache
-
-
Method Details
-
capacity
public final int capacity()Description copied from interface:StringCache
Get a hint about this cache's capacity and behavior.- Specified by:
capacity
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Returns:
- -1 : This is an unbounded cache. 0 : This "cache" doesn't actually perform any caching. >0 : Actual capacity bound.
-
getType
- Specified by:
getType
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Returns:
- The type of the elements in this cache.
-
getEmptyString
- Specified by:
getEmptyString
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Returns:
- A cached STRING_LIKE_TYPE that represents the empty string.
-
getCachedString
@NotNull public final STRING_LIKE_TYPE getCachedString(@NotNull @NotNull StringCompatible protoString) - Specified by:
getCachedString
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Parameters:
protoString
- The string-like CharSequence to look up- Returns:
- A cached STRING_LIKE_TYPE that corresponds to the current value of the CharSequence expressed by protoString
-
getCachedString
- Specified by:
getCachedString
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Parameters:
string
- The String to look up- Returns:
- A cached STRING_LIKE_TYPE that corresponds to the CharSequence expressed by string
-