Beispiel #1
0
        /**
         * Is the key equal to the combined key.
         *
         * @param entry  the entry to compare to
         * @param key1  the first key
         * @param key2  the second key
         * @return true if the key matches
         */
        protected bool isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2)
        {
            MultiKey multi = (MultiKey)entry.getKey();

            return
                (multi.size() == 2 &&
                 (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
                 (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))));
        }
Beispiel #2
0
        /**
         * Is the key equal to the combined key.
         *
         * @param entry  the entry to compare to
         * @param key1  the first key
         * @param key2  the second key
         * @param key3  the third key
         * @param key4  the fourth key
         * @param key5  the fifth key
         * @return true if the key matches
         */
        protected bool isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3, Object key4, Object key5)
        {
            MultiKey multi = (MultiKey)entry.getKey();

            return
                (multi.size() == 5 &&
                 (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
                 (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
                 (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
                 (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3))) &&
                 (key5 == null ? multi.getKey(4) == null : key5.equals(multi.getKey(4))));
        }
Beispiel #3
0
        //-----------------------------------------------------------------------

        /**
         * Removes all mappings where the first key is that specified.
         * <p>
         * This method removes all the mappings where the <code>MultiKey</code>
         * has one or more keys, and the first matches that specified.
         *
         * @param key1  the first key
         * @return true if any elements were removed
         */
        public bool removeAll(Object key1)
        {
            bool        modified = false;
            MapIterator it       = mapIterator();

            while (it.hasNext())
            {
                MultiKey multi = (MultiKey)it.next();
                if (multi.size() >= 1 &&
                    (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))))
                {
                    it.remove();
                    modified = true;
                }
            }
            return(modified);
        }
Beispiel #4
0
        /**
         * Removes all mappings where the first four keys are those specified.
         * <p>
         * This method removes all the mappings where the <code>MultiKey</code>
         * has four or more keys, and the first four match those specified.
         *
         * @param key1  the first key
         * @param key2  the second key
         * @param key3  the third key
         * @param key4  the fourth key
         * @return true if any elements were removed
         */
        public bool removeAll(Object key1, Object key2, Object key3, Object key4)
        {
            bool        modified = false;
            MapIterator it       = mapIterator();

            while (it.hasNext())
            {
                MultiKey multi = (MultiKey)it.next();
                if (multi.size() >= 4 &&
                    (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
                    (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
                    (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
                    (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3))))
                {
                    it.remove();
                    modified = true;
                }
            }
            return(modified);
        }