ArrayTable.java revision 0
0N/A * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * Private storage mechanism for Action key-value pairs. 0N/A * In most cases this will be an array of alternating 0N/A * key-value pairs. As it grows larger it is scaled 0N/A * up to a Hashtable. 0N/A * This does no synchronization, if you need thread safety synchronize on 0N/A * another object before calling this. 0N/A * @author Georges Saab 0N/A * @author Scott Violet 0N/A // Our field for storage 0N/A * Writes the passed in ArrayTable to the passed in ObjectOutputStream. 0N/A * The data is saved as an integer indicating how many key/value 0N/A * pairs are being archived, followed by the the key/value pairs. If 0N/A * <code>table</code> is null, 0 will be written to <code>s</code>. 0N/A * AbstractAction use to avoid having the same code in each class. 0N/A // Determine how many keys have Serializable values, when 0N/A // done all non-null values in keys identify the Serializable 0N/A /* include in Serialization when both keys and values are Serializable */ 0N/A /* include these only so that we get the appropriate exception below */ 0N/A * Put the key-value pair into storage 0N/A }
else {
// We are a hashtable 0N/A * Gets the value for key 0N/A * Returns the number of pairs in storage 0N/A * Returns true if we have a value for the key 0N/A * Removes the key and its value 0N/A * Returns the value for the pair removed 0N/A // Is key on the list? 0N/A // Copy the list up to index 0N/A // Copy from two past the index, up to 0N/A // the end of tmp (which is two elements 0N/A // shorter than the old list) 0N/A // set the listener array to the new array or null 0N/A * Removes all the mappings. 0N/A * Returns a clone of the <code>ArrayTable</code>. 0N/A * Returns the keys of the table, or <code>null</code> if there 0N/A * are currently no bindings. 0N/A * @param keys array of keys 0N/A * @return an array of bindings 0N/A * Returns true if the current storage mechanism is 0N/A * an array of alternating key-value pairs. 0N/A * Grows the storage from an array to a hashtable. 0N/A * Shrinks the storage from a hashtable to an array.