java.lang.Object
model.logic.server.dictionary.LRU
All Implemented Interfaces:
CacheReplacementPolicy

public class LRU extends Object implements CacheReplacementPolicy
  • Constructor Summary

    Constructors
    Constructor
    Description
    LRU()
    The LRU function takes in a string and adds it to the LinkedHashSet.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String word)
    The add function adds a word to the list of words.
    The remove function removes the first word in the list of words.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LRU

      public LRU()
      The LRU function takes in a string and adds it to the LinkedHashSet. If the size of the set is greater than 10, then it removes the first element.
  • Method Details

    • add

      public void add(String word)
      The add function adds a word to the list of words.
      Specified by:
      add in interface CacheReplacementPolicy
      Parameters:
      word - word Add the word to the list of words
    • remove

      public String remove()
      The remove function removes the first word in the list of words.
      Specified by:
      remove in interface CacheReplacementPolicy
      Returns:
      The word that was removed from the words set