001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 * 
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 * 
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.log4j;
019
020/**
021   CategoryKey is a wrapper for String that apparently accellerated
022   hash table lookup in early JVM's.
023   @author Ceki Gülcü 
024*/
025class CategoryKey {
026
027  String   name;  
028  int hashCache;
029
030  CategoryKey(String name) {
031    this.name = name;
032    hashCache = name.hashCode();
033  }
034
035  final
036  public  
037  int hashCode() {
038    return hashCache;
039  }
040
041  final
042  public
043  boolean equals(Object rArg) {
044    if(this == rArg)
045      return true;
046    
047    if(rArg != null && CategoryKey.class == rArg.getClass()) 
048      return  name.equals(((CategoryKey)rArg ).name);
049    else 
050      return false;
051  }
052}