Package java.util

Examples of java.util.HashSet


        }
       
        version = signerversion = 1;
        certs = new ArrayList();
        crls = new ArrayList();
        digestalgos = new HashSet();
        digestalgos.add(digestAlgorithm);
       
        //
        // Copy in the certificates and crls used to sign the private key.
        //
View Full Code Here


       
    QueryResolver.resolveCommand(rsQuery, planEnv.getGlobalMetadata());
    }
   
    private static Collection getExternalGroups(MappingSourceNode sourceNode) {
        Collection externalGroups = new HashSet();

        MappingSourceNode parentSource = sourceNode.getParentSourceNode();
        while (parentSource != null) {
            externalGroups.add(new GroupSymbol(parentSource.getActualResultSetName()));
            parentSource = parentSource.getParentSourceNode();
        }
        return externalGroups;
    }
View Full Code Here

        throws QueryResolverException,QueryMetadataException,TeiidComponentException {
       
        GroupSymbol oldGroupSymbol = new GroupSymbol(oldGroup);
        ResolverUtil.resolveGroup(oldGroupSymbol, metadata);
       
        HashSet projectedElements = new HashSet(ResolverUtil.resolveElementsInGroup(oldGroupSymbol, metadata));
       
        symbolMap.putAll(QueryUtil.createSymbolMap(oldGroupSymbol, newGroup, projectedElements));
    }
View Full Code Here

     */
    private static Set collectSourceNodesInConjunct(Criteria conjunct, MappingNode context, MappingDocument mappingDoc)
        throws QueryPlannerException {
       
        Collection elements = ElementCollectorVisitor.getElements(conjunct, true);
        Set resultSets = new HashSet();
       
        String contextFullName = context.getFullyQualifiedName().toUpperCase();
       
        //validate that each element's group is under the current context or is in the direct parentage
        for (Iterator i = elements.iterator(); i.hasNext();) {
            ElementSymbol elementSymbol = (ElementSymbol)i.next();
           
            String elementFullName = elementSymbol.getCanonicalName();
           
            MappingNode node = MappingNode.findNode(mappingDoc, elementFullName);
           
            MappingNode elementRsNode = node.getSourceNode();
            if (elementRsNode == null) {
                throw new QueryPlannerException(QueryPlugin.Util.getString("CriteriaPlanner.invalid_element", elementSymbol)); //$NON-NLS-1$
            }
           
            String elementRsFullName = elementRsNode.getFullyQualifiedName().toUpperCase();
           
            //check for a match at or below the context
            if (contextFullName.equals(elementRsFullName) ||
                            elementRsFullName.startsWith(contextFullName + ElementSymbol.SEPARATOR)) {
                resultSets.add(elementRsNode);
                continue;
            }
           
            //check for match above the context
            if (contextFullName.startsWith(elementRsFullName + ElementSymbol.SEPARATOR)) {
View Full Code Here

       
        if (context instanceof MappingSourceNode) {
            return (MappingSourceNode)context;
        }

        Set criteriaResultSets = new HashSet();
        // if the context node is not the root node then we need to find the root source node from list.
        for (Iterator i = resultSets.iterator(); i.hasNext();) {

            // these are actually source nodes.
            MappingNode node = (MappingNode)i.next();
  
            MappingNode root = node;
           
            while (node != null) {
                if (node instanceof MappingSourceNode) {
                    root = node;
                }
                node = node.getParent();
            }
            criteriaResultSets.add(root);
        }
  
        if (criteriaResultSets.size() != 1) {
            //TODO: this assumption could be relaxed if we allow context to be from a document perspective, rather than from a result set
            throw new QueryPlannerException(QueryPlugin.Util.getString("CriteriaPlanner.no_context", criteria)); //$NON-NLS-1$
        }
        return (MappingSourceNode)criteriaResultSets.iterator().next();
    }
View Full Code Here

    /**
     * Test for duplicates when generating a bunch of IDs.
     */
    private static void helpTestDuplicates( int nGen ) {
        UUID uuid = null;
        Set uuids = new HashSet();
//        Set duplicates = new HashSet();

        // First test some fairly "regular" numbers...
        for ( int j = 0; j < Math.min(nGen,63); j++ ) {
            long v1 = 1L << j;
            long v2 = (1L << j)/2;
            uuid = new UUID(v1,v2);
            assertTrue( "UUID '" + uuid + "' is a duplicate!", !uuids.contains(uuid) ); //$NON-NLS-1$ //$NON-NLS-2$
            uuids.add(uuid);
        }

        // Then test some random numbers...
        java.util.Random rng = new java.util.Random();
        for ( int k = 0; k < nGen; k++ ) {
            long v1 = rng.nextLong();
            long v2 = rng.nextLong();
            uuid = new UUID(v1,v2);
            if ( uuids.contains(uuid) ) {
                fail( "UUID '" + uuid + "' is a duplicate!" ); //$NON-NLS-1$ //$NON-NLS-2$
            }
            uuids.add(uuid);
        }
    }
View Full Code Here

        Set atomicQueries = TestOptimizer.getAtomicQueries(plan);
        assertEquals("Expected 2 queries to get pushed down", 2, atomicQueries.size()); //$NON-NLS-1$
       
        String expectedSql = "SELECT BQT1.SmallA.StringKey, BQT1.SmallA.IntKey FROM BQT1.SmallA"; //$NON-NLS-1$
        String expectedSql2 = "SELECT BQT1.SmallB.IntKey FROM BQT1.SmallB"; //$NON-NLS-1$
        Set expectedQueries = new HashSet();
        expectedQueries.add(expectedSql);
        expectedQueries.add(expectedSql2);
        assertEquals(expectedQueries, atomicQueries);

        List[] input1 = new List[] {
                                    Arrays.asList(new Object[] { "5", new Integer(5)}), //$NON-NLS-1$
                                };   
View Full Code Here

        assertEquals("Expected 2 queries to get pushed down", 2, atomicQueries.size()); //$NON-NLS-1$
       
        String expectedSql = "SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA, BQT1.SmallB WHERE (BQT1.SmallA.IntKey = BQT1.SmallB.IntKey) AND (BQT1.SmallA.IntKey = 5) AND (BQT1.SmallB.IntKey = 5)"; //$NON-NLS-1$
        String expectedSql2 = "SELECT BQT2.SmallA.IntKey FROM BQT2.SmallA WHERE BQT2.SmallA.IntKey = 5"; //$NON-NLS-1$
       
        Set expectedQueries = new HashSet();
        expectedQueries.add(expectedSql);
        expectedQueries.add(expectedSql2);
        assertEquals(expectedQueries, atomicQueries);

        List[] input1 = new List[] {
                                      Arrays.asList(new Object[] { new Integer(5), new Integer(5)}),
                                  };   
View Full Code Here

    /**
     * Load the stringified UUIDs from a file and test 'stringToObject'.
     */
    public static Collection helpTestStringToObject( String filename, boolean checkForDuplicates ) throws Exception {
        String stringifiedID = null;
        final Set objectIDs = new HashSet();
        try {
            Collection stringifiedIDs = helpLoad(filename);
            if ( DEBUG_PRINT ) {
                System.out.println("# of ids = " + stringifiedIDs.size() ); //$NON-NLS-1$
            }
            final Iterator iter = stringifiedIDs.iterator();
            while (iter.hasNext()) {
                stringifiedID = (String) iter.next();
                final ObjectID objectId = IDGenerator.getInstance().stringToObject(stringifiedID);
                if ( checkForDuplicates && objectIDs.contains(objectId) ) {
                    fail( "ObjectID '" + objectId + "' is a duplicate!" ); //$NON-NLS-1$ //$NON-NLS-2$
                }
                objectIDs.add(objectId);
            }

        } catch ( InvalidIDException e ) {
            fail("Unable to convert stringified ID \"" + stringifiedID + "\" to an ObjectID"); //$NON-NLS-1$ //$NON-NLS-2$
        }
View Full Code Here

    /**
     * Test for duplicates when generating a bunch of IDs.
     */
    private void helpTestDuplicates( int nGen ) {
        UUID uuid = null;
        Set uuids = new HashSet();
//        Set duplicates = new HashSet();

        // Then test some random numbers...
//        java.util.Random rng = new java.util.Random();
        for ( int k = 0; k < nGen; k++ ) {
            uuid = (UUID)generator.create();
            assertTrue( "UUID '" + uuid + "' is a duplicate!", !uuids.contains(uuid) ); //$NON-NLS-1$ //$NON-NLS-2$
            uuids.add(uuid);
        }
    }
View Full Code Here

TOP

Related Classes of java.util.HashSet

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.