Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

MapEntryParameter.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2000-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: MapEntryParameter.java,v 12.1 2005/01/31 19:27:32 mark Exp $
00008  */
00009 
00010 package com.sleepycat.collections;
00011 
00012 import java.util.Map;
00013 
00030 public class MapEntryParameter implements Map.Entry {
00031 
00032     private Object key;
00033     private Object value;
00034 
00042     public MapEntryParameter(Object key, Object value) {
00043 
00044         this.key = key;
00045         this.value = value;
00046     }
00047 
00054     public int hashCode() {
00055 
00056         return ((key == null)    ? 0 : key.hashCode()) ^
00057                ((value == null)  ? 0 : value.hashCode());
00058     }
00059 
00066     public boolean equals(Object other) {
00067 
00068         if (!(other instanceof Map.Entry)) {
00069             return false;
00070         }
00071 
00072         Map.Entry e = (Map.Entry) other;
00073 
00074         return ((key == null) ? (e.getKey() == null)
00075                               : key.equals(e.getKey())) &&
00076                ((value == null) ? (e.getValue() == null)
00077                                 : value.equals(e.getValue()));
00078     }
00079 
00085     public final Object getKey() {
00086 
00087         return key;
00088     }
00089 
00097     public final Object getValue() {
00098 
00099         return value;
00100     }
00101 
00106     public Object setValue(Object newValue) {
00107 
00108         throw new UnsupportedOperationException();
00109     }
00110 
00111     final void setValueInternal(Object newValue) {
00112 
00113         this.value = newValue;
00114     }
00115 
00121     public String toString() {
00122 
00123         return "[key [" + key + "] value [" + value + ']';
00124     }
00125 }
00126 

Generated on Sun Dec 25 12:14:31 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2