286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 2001-2004 The Apache Software Foundation.
286N/A *
286N/A * Licensed under the Apache License, Version 2.0 (the "License");
286N/A * you may not use this file except in compliance with the License.
286N/A * You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A/*
286N/A * $Id: MultiHashtable.java,v 1.2.4.1 2005/09/05 11:18:51 pvedula Exp $
286N/A */
286N/A
286N/Apackage com.sun.org.apache.xalan.internal.xsltc.compiler.util;
286N/A
286N/Aimport java.util.Hashtable;
286N/Aimport java.util.Vector;
286N/A
286N/A/**
286N/A * @author Jacek Ambroziak
286N/A * @author Santiago Pericas-Geertsen
286N/A */
286N/Apublic final class MultiHashtable extends Hashtable {
286N/A static final long serialVersionUID = -6151608290510033572L;
286N/A public Object put(Object key, Object value) {
286N/A Vector vector = (Vector)get(key);
286N/A if (vector == null)
286N/A super.put(key, vector = new Vector());
286N/A vector.add(value);
286N/A return vector;
286N/A }
286N/A
286N/A public Object maps(Object from, Object to) {
286N/A if (from == null) return null;
286N/A final Vector vector = (Vector) get(from);
286N/A if (vector != null) {
286N/A final int n = vector.size();
286N/A for (int i = 0; i < n; i++) {
286N/A final Object item = vector.elementAt(i);
286N/A if (item.equals(to)) {
286N/A return item;
286N/A }
286N/A }
286N/A }
286N/A return null;
286N/A }
286N/A}