public abstract class PrefixTermTacletAppIndexCacheImpl extends PrefixTermTacletAppIndexCache
LRUCache
(the backend is stored in
TermTacletAppIndexCacheSet
). The backend is accessed in a way
that guarantees that two distinct instances of this class never interfere, by
choosing cache keys that are specific for a particular instance of
PrefixTermTacletAppIndexCacheImpl
and cannot be created by
other instances. This ensures that it is safe to use one instance of
LRUCache
for many instances of
PrefixTermTacletAppIndexCacheImpl
(different proofs, different
proof branches, different locations).Modifier and Type | Class and Description |
---|---|
static class |
PrefixTermTacletAppIndexCacheImpl.CacheKey |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<PrefixTermTacletAppIndexCacheImpl.CacheKey,TermTacletAppIndex> |
cache |
private int |
hits |
private PrefixTermTacletAppIndexCacheImpl.CacheKey |
queryCacheKey |
private int |
total |
Modifier | Constructor and Description |
---|---|
protected |
PrefixTermTacletAppIndexCacheImpl(ImmutableList<QuantifiableVariable> prefix,
java.util.Map<PrefixTermTacletAppIndexCacheImpl.CacheKey,TermTacletAppIndex> cache) |
Modifier and Type | Method and Description |
---|---|
private void |
countAccess(boolean hit) |
TermTacletAppIndex |
getIndexForTerm(Term t) |
private PrefixTermTacletAppIndexCacheImpl.CacheKey |
getNewKey(Term t) |
private PrefixTermTacletAppIndexCacheImpl.CacheKey |
getQueryKey(Term t) |
protected abstract java.lang.String |
name()
Only used for debugging purposes
|
void |
putIndexForTerm(Term t,
TermTacletAppIndex index)
Put the taclet app index
index for the term t
in the cache |
getExtendedPrefix, getExtendedPrefix, getPrefix
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
descend
private final java.util.Map<PrefixTermTacletAppIndexCacheImpl.CacheKey,TermTacletAppIndex> cache
private int hits
private int total
private final PrefixTermTacletAppIndexCacheImpl.CacheKey queryCacheKey
protected PrefixTermTacletAppIndexCacheImpl(ImmutableList<QuantifiableVariable> prefix, java.util.Map<PrefixTermTacletAppIndexCacheImpl.CacheKey,TermTacletAppIndex> cache)
public TermTacletAppIndex getIndexForTerm(Term t)
t
, or
null
if no index for this term was found in the
cacheprivate void countAccess(boolean hit)
public void putIndexForTerm(Term t, TermTacletAppIndex index)
ITermTacletAppIndexCache
index
for the term t
in the cacheprotected abstract java.lang.String name()
private PrefixTermTacletAppIndexCacheImpl.CacheKey getNewKey(Term t)
t
that can be
stored in the cache
private PrefixTermTacletAppIndexCacheImpl.CacheKey getQueryKey(Term t)
t
that can be used for cache
queries. Calling this method twice will return the same object
(with different attribute values), i.e., the result is not
supposed to be stored anywhere