Examples of ByteIntMap


Examples of com.gs.collections.api.map.primitive.ByteIntMap

        }
        if (!(obj instanceof ByteIntMap))
        {
            return false;
        }
        ByteIntMap map = (ByteIntMap) obj;
        return map.isEmpty();
    }
View Full Code Here

Examples of com.gs.collections.api.map.primitive.ByteIntMap

        }
        if (!(obj instanceof ByteIntMap))
        {
            return false;
        }
        ByteIntMap map = (ByteIntMap) obj;
        if (map.size() != 1)
        {
            return false;
        }
        return map.containsKey(this.key1) && this.value1 == map.getOrThrow(this.key1);
    }
View Full Code Here

Examples of com.gs.collections.api.map.primitive.ByteIntMap

        if (!(obj instanceof ByteIntMap))
        {
            return false;
        }

        ByteIntMap other = (ByteIntMap) obj;

        if (this.size() != other.size())
        {
            return false;
        }

        if (this.sentinelValues == null)
        {
            if (other.containsKey(EMPTY_KEY) || other.containsKey(REMOVED_KEY))
            {
                return false;
            }
        }
        else
        {
            if (this.sentinelValues.containsZeroKey && (!other.containsKey(EMPTY_KEY) || this.sentinelValues.zeroValue != other.getOrThrow(EMPTY_KEY)))
            {
                return false;
            }

            if (this.sentinelValues.containsOneKey && (!other.containsKey(REMOVED_KEY) || this.sentinelValues.oneValue != other.getOrThrow(REMOVED_KEY)))
            {
                return false;
            }
        }

        for (int i = 0; i < this.keys.length; i++)
        {
            byte key = this.keys[i];
            if (isNonSentinel(key) && (!other.containsKey(key) || this.values[i] != other.getOrThrow(key)))
            {
                return false;
            }
        }
        return true;
View Full Code Here

Examples of net.openhft.koloboke.collect.map.ByteIntMap

                .withHashConfig(HashConfig.getDefault().withGrowFactor(1.999))
                .withKeysDomainComplement((byte) 0, (byte) 0);
        for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
            for (int j = Byte.MIN_VALUE; j <= Byte.MAX_VALUE; j++) {
                for (int k = Byte.MIN_VALUE; k <= Byte.MAX_VALUE; k++) {
                    ByteIntMap map = factory.newMutableMapOf((byte) i, i, (byte) j, j, (byte) k, k);
                    if (map.size() != 3)
                        break;
                    SeparateKVByteIntDHash h = (SeparateKVByteIntDHash) map;
                    String p = toString("Initially: ", h) + " ";
                    assertEquals(3, sizeByValueIterator(map));
                    map.remove((byte) i);
                    assertEquals(2, map.size());
                    assertEquals(2, sizeByValueIterator(map));
                    map.put((byte) i, i);
                    assertEquals(3, map.size());
                    assertEquals(3, sizeByValueIterator(map));

                    map.remove((byte) j);
                    assertEquals(2, map.size());
                    assertEquals(2, sizeByValueIterator(map));
                    map.put((byte) j, j);
                    assertEquals(3, map.size());
                    assertEquals(3, sizeByValueIterator(map));

                    map.remove((byte) k);
                    assertEquals(2, map.size());
                    assertEquals(2, sizeByValueIterator(map));
                    map.put((byte) k, k);
                    assertEquals(3, map.size());
                    assertEquals(3, sizeByValueIterator(map));
                }
            }
        }
    }
View Full Code Here

Examples of net.openhft.koloboke.collect.map.ByteIntMap

                        .withMaxLoad(0.999)
                        // to ensure DHash will be created
                        .withGrowFactor(1.999))
                .withKeysDomainComplement((byte) 0, (byte) 1);

        ByteIntMap map;
        SeparateKVByteIntDHash asDHash;
        for (int i = 0; ; i++) {
            map = factory.newMutableMap(i);
            asDHash = (SeparateKVByteIntDHash) map;
            if (asDHash.capacity() > 128) {
                break;
            }
        }

        int capacity = asDHash.capacity();
        assertEquals(capacity - 1, ((MutableDHash) map).maxSize());
        assertTrue(asDHash.freeValue() == 0 && asDHash.removedValue() == 1 ||
                asDHash.freeValue() == 1 && asDHash.removedValue() == 0);

        for (int i = 2; i < capacity; i++) {
            map.put((byte) i, 0);
        }

        assertTrue(asDHash.freeValue() == 0 && asDHash.removedValue() == 1 ||
                asDHash.freeValue() == 1 && asDHash.removedValue() == 0);
        assertEquals(capacity, asDHash.capacity());

        map.put((byte) 0, 0);

        assertEquals(capacity, asDHash.capacity());
        assertEquals(capacity - 1, sizeByValueIterator(map));
        assertTrue(asDHash.freeValue() != 0 && asDHash.removedValue() == 1 ||
                asDHash.freeValue() == 1 && asDHash.removedValue() != 0);
        assertTrue(map.containsKey((byte) 0));
        assertFalse(map.containsKey((byte) 1));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.