corba/src/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java
author ohair
Tue, 25 May 2010 15:52:11 -0700
changeset 5555 b2b5ed3f0d0d
parent 4 02bb8761fcce
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
/*
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     2
 * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
 *
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    23
 * questions.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
package com.sun.corba.se.impl.oa.poa;
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
import java.util.Set ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
import java.util.HashSet ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
import java.util.Map ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
import java.util.HashMap ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
import java.util.Iterator ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
import java.util.Vector ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
import org.omg.PortableServer.Servant ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
import org.omg.PortableServer.POAPackage.WrongPolicy ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
import org.omg.CORBA.INTERNAL ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
/**  The ActiveObjectMap maintains associations between servants and
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
 * their keys.  There are two variants, to support whether or not
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
 * multiple IDs per servant are allowed.  This class suppots bidirectional
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
 * traversal of the key-servant association.  Access to an instance of this
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
 * class is serialized by the POA mutex.
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
public abstract class ActiveObjectMap
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
{
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
    public static class Key {
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
        public byte[] id;
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
        Key(byte[] id) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
            this.id = id;
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
        public String toString() {
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
            StringBuffer buffer = new StringBuffer();
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
            for(int i = 0; i < id.length; i++) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
                buffer.append(Integer.toString((int) id[i], 16));
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
                if (i != id.length-1)
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
                    buffer.append(":");
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
            }
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
            return buffer.toString();
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
        public boolean equals(java.lang.Object key) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
            if (!(key instanceof Key))
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
                return false;
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
            Key k = (Key) key;
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
            if (k.id.length != this.id.length)
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
                return false;
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
            for(int i = 0; i < this.id.length; i++)
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
                if (this.id[i] != k.id[i])
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
                    return false;
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
            return true;
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
        // Use the same hash function as for String
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
        public int hashCode() {
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
            int h = 0;
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
            for (int i = 0; i < id.length; i++)
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
                h = 31*h + id[i];
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
            return h;
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
    protected POAImpl poa ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
    protected ActiveObjectMap( POAImpl poa )
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
        this.poa = poa ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
    public static ActiveObjectMap create( POAImpl poa, boolean multipleIDsAllowed )
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
        if (multipleIDsAllowed)
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
            return new MultipleObjectMap( poa ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
        else
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
            return new SingleObjectMap(poa ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
    private Map keyToEntry = new HashMap() ;     // Map< Key, AOMEntry >
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
    private Map entryToServant = new HashMap() ; // Map< AOMEntry, Servant >
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
    private Map servantToEntry = new HashMap() ; // Map< Servant, AOMEntry >
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
    public final boolean contains(Servant value)
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
        return servantToEntry.containsKey( value ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
    public final boolean containsKey(Key key)
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
        return keyToEntry.containsKey(key);
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
    /** get Returbs the entry assigned to the key, or creates a new
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
    * entry in state INVALID if none is present.
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
    */
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
    public final AOMEntry get(Key key)
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
        AOMEntry result = (AOMEntry)keyToEntry.get(key);
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
        if (result == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
            result = new AOMEntry( poa ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
            putEntry( key, result ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
        return result ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
    public final Servant getServant( AOMEntry entry )
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
        return (Servant)entryToServant.get( entry ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
    public abstract Key getKey(AOMEntry value) throws WrongPolicy ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
    public Key getKey(Servant value) throws WrongPolicy
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
        AOMEntry entry = (AOMEntry)servantToEntry.get( value ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
        return getKey( entry ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
    protected void putEntry( Key key, AOMEntry value )
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
        keyToEntry.put( key, value ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
    public final void putServant( Servant servant, AOMEntry value )
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
        entryToServant.put( value, servant ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
        servantToEntry.put( servant, value ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
    protected abstract void removeEntry( AOMEntry entry, Key key ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
    public final void remove( Key key )
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
        AOMEntry entry = (AOMEntry)keyToEntry.remove( key ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
        Servant servant = (Servant)entryToServant.remove( entry ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
        if (servant != null)
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
            servantToEntry.remove( servant ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
        removeEntry( entry, key ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
    public abstract boolean hasMultipleIDs(AOMEntry value) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
    protected  void clear()
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
        keyToEntry.clear();
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
    public final Set keySet()
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
        return keyToEntry.keySet() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
}
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
class SingleObjectMap extends ActiveObjectMap
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
{
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
    private Map entryToKey = new HashMap() ;    // Map< AOMEntry, Key >
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
    public SingleObjectMap( POAImpl poa )
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
        super( poa ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
    public  Key getKey(AOMEntry value) throws WrongPolicy
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
        return (Key)entryToKey.get( value ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
    protected void putEntry(Key key, AOMEntry value)
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
        super.putEntry( key, value);
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
        entryToKey.put( value, key ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
    public  boolean hasMultipleIDs(AOMEntry value)
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
        return false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
    // This case does not need the key.
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
    protected void removeEntry(AOMEntry entry, Key key)
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
        entryToKey.remove( entry ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
    public  void clear()
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
        super.clear() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
        entryToKey.clear() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
}
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
class MultipleObjectMap extends ActiveObjectMap
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
{
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
    private Map entryToKeys = new HashMap() ;   // Map< AOMEntry, Set< Key > >
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
    public MultipleObjectMap( POAImpl poa )
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
        super( poa ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
    public  Key getKey(AOMEntry value) throws WrongPolicy
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
        throw new WrongPolicy() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
    protected void putEntry(Key key, AOMEntry value)
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
        super.putEntry( key, value);
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
        Set set = (Set)entryToKeys.get( value ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
        if (set == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
            set = new HashSet() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
            entryToKeys.put( value, set ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   238
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   239
        set.add( key ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   240
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   241
02bb8761fcce Initial load
duke
parents:
diff changeset
   242
    public  boolean hasMultipleIDs(AOMEntry value)
02bb8761fcce Initial load
duke
parents:
diff changeset
   243
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   244
        Set set = (Set)entryToKeys.get( value ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   245
        if (set == null)
02bb8761fcce Initial load
duke
parents:
diff changeset
   246
            return false ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   247
        return set.size() > 1 ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   248
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   249
02bb8761fcce Initial load
duke
parents:
diff changeset
   250
    protected void removeEntry(AOMEntry entry, Key key)
02bb8761fcce Initial load
duke
parents:
diff changeset
   251
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   252
        Set keys = (Set)entryToKeys.get( entry ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   253
        if (keys != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   254
            keys.remove( key ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   255
            if (keys.isEmpty())
02bb8761fcce Initial load
duke
parents:
diff changeset
   256
                entryToKeys.remove( entry ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   257
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   258
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   259
02bb8761fcce Initial load
duke
parents:
diff changeset
   260
    public  void clear()
02bb8761fcce Initial load
duke
parents:
diff changeset
   261
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   262
        super.clear() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   263
        entryToKeys.clear() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   264
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   265
}