Package gnu.trove.set.hash

Examples of gnu.trove.set.hash.TIntHashSet


        for ( int i = 0; i < keyset.size(); i++ ) {
            assertTrue( keyset.contains( keys[i] ) );
        }
        assertFalse( keyset.isEmpty() );

        TIntCollection test_collection = new TIntHashSet();
        for ( int i = 0; i < element_count; i++ ) {
            test_collection.add( keys[i] );
        }
        assertTrue( keyset.containsAll( test_collection ) ) ;
        assertTrue( keyset.equals( keyset ) );

        test_collection.remove( Integer.valueOf( keys[5] ) );
        assertTrue( "should contain all. keyset: " + keyset + ", " + test_collection,
                keyset.containsAll( test_collection ) );

        test_collection.add( 1138 );
        assertFalse( "should not contain all. keyset: " + keyset + ", " + test_collection,
                keyset.containsAll( test_collection ) );
    }
View Full Code Here


        for ( int i = 0; i < keyset.size(); i++ ) {
            assertTrue( keyset.contains( keys[i] ) );
        }
        assertFalse( keyset.isEmpty() );

        TIntSet other = new TIntHashSet();
        other.addAll( keys );

        assertTrue( "sets incorrectly not equal: " + keyset + ", " + other,
                keyset.equals( other ) );

        int[] mismatched = {72, 49, 53, 1024, 999};
        TIntSet unequal = new TIntHashSet();
        unequal.addAll( mismatched );

        assertFalse( "sets incorrectly equal: " + keyset + ", " + unequal,
                keyset.equals( unequal ) );

        // Change length, different code branch
        unequal.add( 1 );
        assertFalse( "sets incorrectly equal: " + keyset + ", " + unequal,
                keyset.equals( unequal ) );

        //noinspection ObjectEqualsNull
        assertFalse( keyset.equals( null ) );
View Full Code Here

        }
        assertFalse( keyset.isEmpty() );

        assertEquals( keyset.hashCode(), keyset.hashCode() );

        TIntSet other = new TIntHashSet( keys );
        other.add( 1138 );
        assertTrue( keyset.hashCode() != other.hashCode() );
    }
View Full Code Here

            assertEquals( keys_array[count], key );
            count++;
        }
        assertEquals( keyset.getNoEntryValue(), keys_array[keyset.size()] );

        TIntSet other = new TIntHashSet( keyset );
        assertFalse( keyset.retainAll( other ) );
        other.remove( keys[5] );
        assertTrue( keyset.retainAll( other ) );
        assertFalse( keyset.contains( keys[5] ) );
        assertFalse( map.containsKey( keys[5] ) );

        keyset.clear();
View Full Code Here

        catch ( UnsupportedOperationException ex ) {
            // Expected
        }

        try {
            TIntSet test = new TIntHashSet();
            test.add( 1138 );
            keyset.addAll( test );
            fail( "Expected UnsupportedOperationException" );
        }
        catch ( UnsupportedOperationException ex ) {
            // Expected
View Full Code Here

            assertEquals(keys_array[count], key);
            count++;
        }
        assertNull(keys_array[keyset.size()]);

        TIntSet raw_other = new TIntHashSet(keyset);
        Set<Integer> other = TDecorators.wrap(raw_other);
        assertFalse(keyset.retainAll(other));
        other.remove(keys[5]);
        assertTrue(keyset.retainAll(other));
        assertFalse(keyset.contains(keys[5]));
View Full Code Here

  }


  public void testUnmodifiableSet() {
    final TIntSet one = new TIntHashSet( new int[]{ 1, 2, 3, 4 } );
    final TIntSet two = new TIntHashSet( new int[]{ 1, 2, 3, 4 } );
    TIntSet uOne = TCollections.unmodifiableSet( one );
    TIntSet uTwo = TCollections.unmodifiableSet( two );

    assertEquals( one, two );
    assertEquals( uOne, uTwo );
View Full Code Here

        if (toIsSymbolic)
            newTo = mapping.getSign() ? Tensors.negate(to) : to;
        else {
            if (possiblyAddsDummies) {
                if (forbidden.forbidden == null)
                    forbidden.forbidden = new TIntHashSet(iterator.getForbidden());

                TIntHashSet remainderIndices = new TIntHashSet(forbidden.forbidden);
                remainderIndices.addAll(getAllIndicesNamesT(indexlessRemainder));
                remainderIndices.addAll(getAllIndicesNamesT(dataRemainderT));
                newTo = applyIndexMapping(to, mapping, remainderIndices.toArray());
                forbidden.forbidden.addAll(getAllIndicesNamesT(newTo));
            } else {
                TIntHashSet allowed = new TIntHashSet();
                for (int index : indexlessBijection)
                    allowed.addAll(TensorUtils.getAllDummyIndicesT(content.indexless[index]));
                IndicesBuilder ib = new IndicesBuilder();
                for (int index : dataBijection) {
                    allowed.addAll(TensorUtils.getAllDummyIndicesT(currentData[index]));
                    ib.append(currentData[index]);
                }
                allowed.addAll(ib.getIndices().getNamesOfDummies());
                allowed.removeAll(IndicesUtils.getIndicesNames(mapping.getToData()));
                newTo = applyIndexMappingAndRenameAllDummies(to, mapping, allowed.toArray());
            }
        }
        return new SubsResult(newTo, remainder);
    }
View Full Code Here

        if (supposeIndicesAreAdded) {
            StackPosition<ForbiddenContainer> previous = innerIterator.currentStackPosition().previous();
            if (previous != null) {

                TIntHashSet oldDummyIndices = TensorUtils.getAllDummyIndicesT(oldTensor);
                TIntHashSet newDummyIndices = TensorUtils.getAllDummyIndicesT(tensor);

                TIntHashSet added = new TIntHashSet(newDummyIndices);
                added.removeAll(oldDummyIndices);

                if (!added.isEmpty() || previous.isPayloadInitialized()) {
                    ForbiddenContainer fc = previous.getPayload();

                    TIntHashSet removed = new TIntHashSet(oldDummyIndices);
                    removed.removeAll(newDummyIndices);

                    fc.submit(removed, added);
                }
            }
        }
View Full Code Here

        public abstract void insureInitialized();

        @Override
        public TIntSet getForbidden() {
            insureInitialized();
            TIntHashSet result = new TIntHashSet(forbidden);
//            result.removeAll(TensorUtils.getAllIndicesNamesT(position.tensor.get(currentBranch)));
            result.removeAll(TensorUtils.getAllIndicesNamesT(tensor.get(position.currentIndex())));
            return result;
        }
View Full Code Here

TOP

Related Classes of gnu.trove.set.hash.TIntHashSet

Copyright © 2018 www.massapicom. 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.