commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject cvs commit: jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru LRUElementImp.java
Date Sat, 16 Feb 2002 23:20:32 GMT
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:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message