ArrayTable.java revision 625
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. * In most cases this will be an array of alternating * key-value pairs. As it grows larger it is scaled * This does no synchronization, if you need thread safety synchronize on * another object before calling this. * Writes the passed in ArrayTable to the passed in ObjectOutputStream. * The data is saved as an integer indicating how many key/value * pairs are being archived, followed by the the key/value pairs. If * <code>table</code> is null, 0 will be written to <code>s</code>. * AbstractAction use to avoid having the same code in each class. // Determine how many keys have Serializable values, when // done all non-null values in keys identify the Serializable /* include in Serialization when both keys and values are Serializable */ /* include these only so that we get the appropriate exception below */ // Write ou the Serializable key/value pairs. * Put the key-value pair into storage }
else {
// We are a hashtable * Returns the number of pairs in storage * Returns true if we have a value for the key * Removes the key and its value * Returns the value for the pair removed // Copy the list up to index // Copy from two past the index, up to // the end of tmp (which is two elements // shorter than the old list) // set the listener array to the new array or null * Removes all the mappings. * Returns a clone of the <code>ArrayTable</code>. * Returns the keys of the table, or <code>null</code> if there * are currently no bindings. * @param keys array of keys * @return an array of bindings * Returns true if the current storage mechanism is * an array of alternating key-value pairs. * Grows the storage from an array to a hashtable. * Shrinks the storage from a hashtable to an array.