/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* 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
* up to a Hashtable.
* <p>
* This does no synchronization, if you need thread safety synchronize on
* another object before calling this.
*
* @author Georges Saab
* @author Scott Violet
*/
// Our field for storage
/**
* Writes the passed in ArrayTable to the passed in ObjectOutputStream.
* <code>table</code> is null, 0 will be written to <code>s</code>.
* <p>
* AbstractAction use to avoid having the same code in each class.
*/
s.writeInt(0);
}
else {
// Determine how many keys have Serializable values, when
// done all non-null values in keys identify the Serializable
// values.
int validCount = 0;
/* include in Serialization when both keys and values are Serializable */
if ( (key instanceof Serializable
||
/* include these only so that we get the appropriate exception below */
(key instanceof ClientPropertyKey
validCount++;
} else {
}
}
s.writeInt(validCount);
if (validCount > 0) {
s.writeObject(key);
if (--validCount == 0) {
break;
}
}
}
}
}
}
/*
* Put the key-value pair into storage
*/
} else {
if (containsKey(key)) {
break;
}
}
} else {
}
} else { // We are a hashtable
grow();
}
}
}
}
/*
* Gets the value for key
*/
if (isArray()) {
break;
}
}
} else {
}
}
return value;
}
/*
* Returns the number of pairs in storage
*/
public int size() {
int size;
return 0;
if (isArray()) {
} else {
}
return size;
}
/*
* Returns true if we have a value for the key
*/
boolean contains = false;
if (isArray()) {
contains = true;
break;
}
}
} else {
}
}
return contains;
}
/*
* Removes the key and its value
* Returns the value for the pair removed
*/
return null;
}
if (isArray()){
// Is key on the list?
int index = -1;
index = i;
break;
}
}
// If so, remove it
if (index != -1) {
// 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
}
} else {
}
shrink();
}
}
return value;
}
/**
* Removes all the mappings.
*/
public void clear() {
}
/*
* Returns a clone of the <code>ArrayTable</code>.
*/
if (isArray()) {
}
} else {
while (keys.hasMoreElements()) {
}
}
return newArrayTable;
}
/**
* 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
*/
return null;
}
if (isArray()) {
}
index++) {
}
} else {
}
while (counter > 0) {
}
}
return keys;
}
/*
* Returns true if the current storage mechanism is
* an array of alternating key-value pairs.
*/
private boolean isArray(){
}
/*
* Grows the storage from an array to a hashtable.
*/
private void grow() {
}
}
/*
* Shrinks the storage from a hashtable to an array.
*/
private void shrink() {
int j = 0;
while (keys.hasMoreElements()) {
array[j] = o;
j+=2;
}
}
}