You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by as...@apache.org on 2002/02/17 00:20:32 UTC

cvs commit: jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru LRUElementImp.java

asmuts      02/02/16 15:20:32

  Added:       util/src/java/org/apache/commons/util/lru LRUElementImp.java
  Log:
  specialized LRUElement
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUElementImp.java
  
  Index: LRUElementImp.java
  ===================================================================
  package org.apache.commons.util.lru;
  
  import java.io.Serializable;
  
  import org.apache.commons.util.lru.ILRUElement;
  
  /**
   *  Generic element wrapper. Often stuffed inside another. Can extend and use
   *  the LRUStore put method. Can get out of the LRUStore with the wrapper on as
   *  well. Pulled from JCS project for ease of use.
   *
   *@author     asmuts
   *@created    January 15, 2002
   */
  public class LRUElementImp implements ILRUElement, Serializable
  {
  
      /**
       *  Description of the Field
       */
      public final Serializable key;
      /**
       *  Description of the Field
       */
      public final Serializable val;
  
      /**
       *  Creation time
       */
      public final long createTime;
  
  
      //////////////////////////////////////////////////////////////////
      /**
       *  Constructor for the LRUElement object
       *
       *@param  key        Description of the Parameter
       *@param  val        Description of the Parameter
       */
      public LRUElementImp( Serializable key, Serializable val )
      {
          this.key = key;
          this.val = val;
          // may want to disable this.
          createTime = System.currentTimeMillis();
      }
  
  
      //////////////////////////////////////////
      /**
       *  Constructor for the LRUElement object
       *
       *@param  key        Description of the Parameter
       *@param  val        Description of the Parameter
       */
      public LRUElementImp( Serializable key, Object val )
      {
          this( key, ( Serializable ) val );
      }
  
  
      /////////////////////////////////////
      /**
       *  Gets the key attribute of the LRUElement object
       *
       *@return    The key value
       */
      public Serializable getKey()
      {
          return this.key;
      }
  
  
      //////////////////////////////////////
      /**
       *  Gets the val attribute of the LRUElement object
       *
       *@return    The val value
       */
      public Serializable getVal()
      {
          return this.val;
      }
  
  
      //////////////////////////////////////
      /**
       *  Gets the createTime attribute of the LRUElement object
       *
       *@return    The createTime value
       */
      public long getCreateTime()
      {
          return this.createTime;
      }
  
      ///////////////////////////////////////////////////////////
      /**
       *  Description of the Method
       *
       *@return    Description of the Return Value
       */
      public int hashCode()
      {
          return key.hashCode();
      }
  
  
      ///////////////////////////////////////////////////
      /**
       *  Description of the Method
       *
       *@return    Description of the Return Value
       */
      public String toString()
      {
          return "[key=" + key + ", val=" + val + " createTime " + this.createTime + "]";
      }
  
  }
  // end class
  
  
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>