00001 /*- 00002 * See the file LICENSE for redistribution information. 00003 * 00004 * Copyright (c) 2000-2005 00005 * Sleepycat Software. All rights reserved. 00006 * 00007 * $Id: StoredMapEntry.java,v 12.1 2005/01/31 19:27:32 mark Exp $ 00008 */ 00009 00010 package com.sleepycat.collections; 00011 00015 final class StoredMapEntry extends MapEntryParameter { 00016 00017 private StoredIterator iter; 00018 private StoredCollection coll; 00019 00020 StoredMapEntry(Object key, Object value, StoredCollection coll, 00021 StoredIterator iter) { 00022 00023 super(key, value); 00024 // Assert: coll, coll.keyBinding/valueBinding 00025 this.coll = coll; 00026 this.iter = iter; 00027 } 00028 00029 public Object setValue(Object newValue) { 00030 00031 Object oldValue; 00032 if (iter != null && iter.isCurrentData(this)) { 00033 oldValue = getValue(); 00034 iter.set(newValue); 00035 } else { 00036 oldValue = coll.put(getKey(), newValue); 00037 } 00038 setValueInternal(newValue); 00039 return oldValue; 00040 } 00041 }