Class ConceptCacheLRU

  • All Implemented Interfaces:
    java.util.Map<openllet.aterm.ATermAppl,​CachedNode>, ConceptCache

    public class ConceptCacheLRU
    extends AbstractConceptCache

    Description: Least Recently Used implementation of ConceptCache. Primitive concepts and their negation are always kept in the cache. The least recently used complex concept will be removed from the cache if the max size is reached.

    Copyright: Copyright (c) 2007

    Company: Clark & Parsia, LLC.

    Author:
    Ron Alford
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      ConceptCacheLRU​(KnowledgeBase kb)
      Creates an empty ConceptCacheImpl with no size restrictions Using this constructor is equivalent to break the auto-flush LRU policy of this cache.
      ConceptCacheLRU​(KnowledgeBase kb, int maxSize)
      Creates an empty _cache with at most maxSize elements which are neither named or negations of names.
    • Constructor Detail

      • ConceptCacheLRU

        public ConceptCacheLRU​(KnowledgeBase kb)
        Creates an empty ConceptCacheImpl with no size restrictions Using this constructor is equivalent to break the auto-flush LRU policy of this cache.
        Parameters:
        kb -
      • ConceptCacheLRU

        public ConceptCacheLRU​(KnowledgeBase kb,
                               int maxSize)
        Creates an empty _cache with at most maxSize elements which are neither named or negations of names.
        Parameters:
        kb -
        maxSize -
    • Method Detail

      • getSafety

        public CacheSafety getSafety()
        Description copied from interface: ConceptCache
        Returns safety checker that tells which concepts are safe to _cache.
        Returns:
        safety checker
      • clear

        public void clear()
      • containsKey

        public boolean containsKey​(java.lang.Object key)
      • containsValue

        public boolean containsValue​(java.lang.Object value)
      • entrySet

        public java.util.Set<java.util.Map.Entry<openllet.aterm.ATermAppl,​CachedNode>> entrySet()
      • get

        public CachedNode get​(java.lang.Object key)
      • isEmpty

        public boolean isEmpty()
      • keySet

        public java.util.Set<openllet.aterm.ATermAppl> keySet()
      • put

        public CachedNode put​(openllet.aterm.ATermAppl key,
                              CachedNode value)
        key can't be null, value can't be null.
      • putAll

        public void putAll​(java.util.Map<? extends openllet.aterm.ATermAppl,​? extends CachedNode> t)
      • remove

        public CachedNode remove​(java.lang.Object key)
      • size

        public int size()
      • values

        public java.util.Collection<CachedNode> values()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object