Package cern.colt.map

Examples of cern.colt.map.OpenIntObjectHashMap


                vertexIndex, verticesCount, showProgressToLog, structuresForConcordantShift);

        for (int h = 0; h < hss.size(); h++)
        {
            IHyperStructure hs = (IHyperStructure) hss.get(h);
            OpenIntObjectHashMap prevTierVertices = (OpenIntObjectHashMap) hs.getTiers().get(nextTierIndex - 1);
            IVertex prevTierVertex = (IVertex) prevTierVertices.get(tierKeyOfTheVertexToShift);
            ICompactTripletsStructure substructureEdge = (ICompactTripletsStructure) substructureEdges.get(h);
           
            if (substructureEdge.isEmpty())
            {
                //  Mark all vertices of HSS tierIndex with empty edges
                prevTierVertex.foundEmptyEdge(edgeKind);
            }
           
            OpenIntObjectHashMap tierVertices = null;
            IVertex existingVertex = null;
           
            if (nextTierIndex < hs.getTiers().size())
            {
                tierVertices = (OpenIntObjectHashMap) hs.getTiers().get(nextTierIndex);
                existingVertex = (IVertex) tierVertices.get(adjoinTarget.getTierKey());
            }
           
            //  If the vertex is already on the next tier...
            if (existingVertex != null)
            {
View Full Code Here


        //  Parallel concretization
        int prevTierIndex = nextTierIndex - 1;
        for (int h = 0; h < hss.size(); h++)
        {
            IHyperStructure hs = (IHyperStructure) hss.get(h);
            OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) hs.getTiers().get(prevTierIndex);
            IVertex vertexToShift = (IVertex) prevTier.get(tierKeyOfTheVertexToShift);
            //  Work with a copy of substructure-vertex to keep original substructure the same
            ICompactTripletsStructure substructureEdge = (ICompactTripletsStructure) vertexToShift.getCTS().clone();
            substructureEdge.concretize(cName, cValue);
            structuresForConcordantShift.substructureEdges.add(substructureEdge);
        }
       
        try
        {
            if (LOGGER.isDebugEnabled())
            {
                LOGGER.debug("Unify intermediate structures after concretization during concordant shift of {} tier #{} of {} total",
                        new Object[] { SimpleTripletValueFactory.getTripletValue(tierKeyOfTheVertexToShift), prevTierIndex + 1,
                        ((IHyperStructure) hss.get(0)).getBasicCTS().getTiers().size() });
            }
            unifyIntermediateSubstructures(structuresForConcordantShift.substructureEdges);
        }
        catch (EmptyStructureException e)
        {
            //  If substructure-edge become empty after concretization step, then resulting substructure-edge will also be empty.
            //  And if substructure-edge is empty at least in one HS, it will be empty in the entire HSS
            clear(structuresForConcordantShift.substructureEdges);
            return structuresForConcordantShift.substructureEdges;
        }
       
        IHyperStructure basicGraph = (IHyperStructure) hss.get(0);
       
        //  Parallel filtration
        for (int s = 0; s < prevTierIndex; s++)
        {
            //  Parallel intersection
            int sTierSize = ((OpenIntObjectHashMap) basicGraph.getTiers().get(s)).size();
           
            for (int h = 0; h < hss.size(); h++)
            {
                IHyperStructure hs = (IHyperStructure) hss.get(h);
                OpenIntObjectHashMap sTierVertices = (OpenIntObjectHashMap) hs.getTiers().get(s);
                ObjectArrayList intersections = (ObjectArrayList) structuresForConcordantShift.hsIntersections.get(h);
                intersections.clear();
               
                for (int sv = 0; sv < sTierSize; sv++)
                {
                    IVertex sTierVertex = (IVertex) sTierVertices.values().get(sv);
                   
                    ICompactTripletsStructure clone = (ICompactTripletsStructure) ((ICompactTripletsStructure) structuresForConcordantShift.substructureEdges.get(h)).clone();
                    clone.intersect(sTierVertex.getCTS());
                    intersections.add(clone);
                }
View Full Code Here

    private static int countDirtyTiers(IHyperStructure basicGraph)
    {
        int count = 0;
        for (int i = basicGraph.getTiers().size() - 1; i >= 0; i--)
        {
            OpenIntObjectHashMap tierVertices = (OpenIntObjectHashMap) basicGraph.getTiers().get(i);
            IVertex tierVertex = (IVertex) tierVertices.get(tierVertices.keys().get(0));
            if (tierVertex.isDirty())
            {
                count++;
            }
            else
View Full Code Here

     */
    private static void unifyCoincidentSubstructuresOfATier(final ObjectArrayList hss, final int tierIndex)
    {
        IHyperStructure firstHS = (IHyperStructure) hss.get(0);

        final OpenIntObjectHashMap basicTierVertices = (OpenIntObjectHashMap) firstHS.getTiers().get(tierIndex);

        IntArrayList keys = basicTierVertices.keys();
       
        if (LOGGER.isDebugEnabled())
        {
            LOGGER.debug("Tier #{} of HSS contained {} vertices before unification: {}",
                    new Object[] { tierIndex + 1, basicTierVertices.size(), verticesTripletsToString(basicTierVertices) });
        }

        for (int j = 0; j < keys.size(); j++)
        {
            int vertexTierKey = keys.get(j);
           
            //  List of ICompactTripletsStructureHolder
            ObjectArrayList vertices = new ObjectArrayList(hss.size());
           
            for (int i = 0; i < hss.size(); i++)
            {
                IHyperStructure hs = (IHyperStructure) hss.get(i);
                       
                IVertex vertex = (IVertex) ((OpenIntObjectHashMap) hs.getTiers().get(tierIndex)).get(vertexTierKey);
               
                vertices.add(vertex);
            }
           
            try
            {
                if (hss.size() > 1)
                {
                    unify(vertices);
                }
                else
                {
                    //  Cross-hyperstructure unification is not applicable for
                    //  HSS if there's less than 2 structures in it.
                    //  But if we have any empty substructure-vertex in vertices
                    //  we should remove this vertex from the basic graph
                    for (int i = 0; i < vertices.size(); i++)
                    {
                        IVertex vertex = (IVertex) vertices.get(i);
                        if (vertex.getCTS().isEmpty())
                        {
                            throw new EmptyStructureException(vertex.getCTS());
                        }
                    }
                }
            }
            catch (EmptyStructureException e)
            {
                removeVertexWithEmptySubstructureFromHSSAndBG(hss, tierIndex, vertexTierKey, vertices);
            }
        }

        if (LOGGER.isDebugEnabled())
        {
            LOGGER.debug("Tier #{} of HSS contained {} vertices after unification: {}",
                    new Object[] { tierIndex + 1, basicTierVertices.size(), verticesTripletsToString(basicTierVertices) });
        }
    }
View Full Code Here

        //  Remove vertex with empty substructure from HSS and BG
        for (int i = 0; i < hss.size(); i++)
        {
            IHyperStructure hs = (IHyperStructure) hss.get(i);
           
            OpenIntObjectHashMap hsTierVertices = (OpenIntObjectHashMap) hs.getTiers().get(tierIndex);

            IVertex vertex = (IVertex) hsTierVertices.get(vertexTierKey);

            hsTierVertices.removeKey(vertexTierKey);
           
            if (LOGGER.isDebugEnabled())
            {
                LOGGER.debug("Vertex {} removed from tier #{} of HSS({}): {}",
                        new Object[] { vertex.getTripletValue(), tierIndex + 1, i, verticesTripletsToString(hsTierVertices) });
View Full Code Here

            int dirtyTierIndex = tierIndex - d;
            if (dirtyTierIndex < 0 || dirtyTierIndex >= hs.getTiers().size())
            {
                break;
            }
            OpenIntObjectHashMap dirtyTierVertices = (OpenIntObjectHashMap) hs.getTiers().get(dirtyTierIndex);
            dirtyTierVertices.forEachPair(new IntObjectProcedure()
            {
                public boolean apply(int key, Object value)
                {
                    ((IVertex) value).markDirty();
                    return true;
                }
            });
        }
        tierIndex++;
        while (tierIndex < hs.getTiers().size())
        {
            OpenIntObjectHashMap dirtyTierVertices = (OpenIntObjectHashMap) hs.getTiers().get(tierIndex);
            dirtyTierVertices.forEachPair(new IntObjectProcedure()
            {
                public boolean apply(int key, Object value)
                {
                    ((IVertex) value).markDirty();
                    return true;
View Full Code Here

       
        //  List of OpenIntObjectHashMap
        ObjectArrayList tiers = hs.getTiers();
        for (int i = 0; i < tiers.size(); i++)
        {
            final OpenIntObjectHashMap tier = (OpenIntObjectHashMap) tiers.get(i);
            ITier ctsTier =  (ITier) ctsTiers.get(i);

            final int tierIndex = i;
           
            final int y = offsetTop + heightOfZeroChar + tierIndex * heightOfZeroChar + tierIndex * heightBetweenTriplets;

            graphics.drawString((format("({0},{1},{2}) j={3}",
                                    getLegendName(ctsTier.getAName()),
                                    getLegendName(ctsTier.getBName()),
                                    getLegendName(ctsTier.getCName()),
                                    tierIndex + 1)),
                                widthOfValuesArea, y);

            tier.forEachPair(new IntObjectProcedure()
            {
                public boolean apply(int tierKey, Object value)
                {
                    IVertex vertex = (IVertex) value;
                   
View Full Code Here

//        }

        ObjectArrayList result = new ObjectArrayList(tiersCount);
        ObjectArrayList structures = new ObjectArrayList();

        OpenIntObjectHashMap verticesFromLastTiers = new OpenIntObjectHashMap();
        fillVerticesFromLastTier(hss, structures, verticesFromLastTiers);

        byte prevVertexTierKey = findIntersectionWithFirstTier(hss, result, structures, verticesFromLastTiers);

        if (prevVertexTierKey == -1)
        {
            throw new AssertionError("There must be at least one non-empty same-name intersection of last-tier vertex with first-tier vertex of HSS");
        }
       
        for (int j = 1; j < tiersCount - 1; j++)
        {
            ObjectArrayList intersections = new ObjectArrayList();
            ObjectArrayList targetVertices = new ObjectArrayList();
           
            boolean allNotEmpty = true;
            //  Check bottomVertex1
            for (int h = 0; h < hss.size(); h++)
            {
                IHyperStructure hs = (IHyperStructure) hss.get(h);
               
                OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) hs.getTiers().get(j - 1);
               
                IVertex prevTierVertex = (IVertex) prevTier.get(prevVertexTierKey);
               
                OpenIntObjectHashMap nextTier = (OpenIntObjectHashMap) hs.getTiers().get(j);

                IVertex bottomVertex1 = prevTierVertex.getBottomVertex1();

                if (bottomVertex1 == null)
                {
                    allNotEmpty = false;
                    break;
                }
               
                IVertex nextTierVertex = (IVertex) nextTier.get(bottomVertex1.getTripletValue().getTierKey());
               
                if (nextTierVertex == null)
                {
                    allNotEmpty = false;
                    break;
                }
               
                ICompactTripletsStructure clone = (ICompactTripletsStructure) ((ICompactTripletsStructure) structures.get(h)).clone();
               
                clone.intersect(nextTierVertex.getCTS());
               
                if (clone.isEmpty())
                {
                    allNotEmpty = false;
                    break;
                }
               
                targetVertices.add(nextTierVertex);
                intersections.add(clone);
            }
           
            allNotEmpty = allNotEmpty && forwardFilterPassed(hss, targetVertices, j, tiersCount, intersections, verticesFromLastTiers);
           
            if (allNotEmpty)
            {
                //  Intersection with bottomVertex1
                OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) basicGraph.getTiers().get(j - 1);
               
                IVertex prevTierVertex = (IVertex) prevTier.get(prevVertexTierKey);
               
                IVertex vertex = prevTierVertex.getBottomVertex1();
               
                result.add(vertex);
               
                prevVertexTierKey = vertex.getTripletValue().getTierKey();
               
                updateStructures(hss, structures, j, prevVertexTierKey);
               
                continue;
            }
            intersections = new ObjectArrayList();
            targetVertices = new ObjectArrayList();
            allNotEmpty = true;
            //  Check bottomVertex2
            for (int h = 0; h < hss.size(); h++)
            {
                IHyperStructure hs = (IHyperStructure) hss.get(h);
               
                OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) hs.getTiers().get(j - 1);
               
                IVertex prevTierVertex = (IVertex) prevTier.get(prevVertexTierKey);
               
                OpenIntObjectHashMap nextTier = (OpenIntObjectHashMap) hs.getTiers().get(j);

                IVertex bottomVertex2 = prevTierVertex.getBottomVertex2();

                if (bottomVertex2 == null)
                {
                    allNotEmpty = false;
                    break;
                }

                IVertex nextTierVertex = (IVertex) nextTier.get(bottomVertex2.getTripletValue().getTierKey());

                if (nextTierVertex == null)
                {
                    allNotEmpty = false;
                    break;
                }

                ICompactTripletsStructure clone = (ICompactTripletsStructure) ((ICompactTripletsStructure) structures.get(h)).clone();

                clone.intersect(nextTierVertex.getCTS());
               
                if (clone.isEmpty())
                {
                    allNotEmpty = false;
                    break;
                }
               
                targetVertices.add(nextTierVertex);
                intersections.add(clone);
            }
           
            allNotEmpty = allNotEmpty && forwardFilterPassed(hss, targetVertices, j, tiersCount, intersections, verticesFromLastTiers);
           
            if (allNotEmpty)
            {
                //  Intersection with bottomVertex2
                OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) basicGraph.getTiers().get(j - 1);
               
                IVertex prevTierVertex = (IVertex) prevTier.get(prevVertexTierKey);
               
                IVertex vertex = prevTierVertex.getBottomVertex2();
               
                result.add(vertex);
               
View Full Code Here

               
                for (int h = 0; h < hss.size(); h++)
                {
                    IHyperStructure hs = (IHyperStructure) hss.get(h);
                   
                    OpenIntObjectHashMap tierVertices = (OpenIntObjectHashMap) hs.getTiers().get(j);
                   
                    IVertex tierVertex = (IVertex) tierVertices.values().get(s);
                   
                    ICompactTripletsStructure clone = (ICompactTripletsStructure) ((ICompactTripletsStructure) structures.get(h)).clone();
                   
                    clone.intersect(tierVertex.getCTS());
                   
View Full Code Here

           
            unifyIntermediateSubstructures(substructures);
           
            for (int j2 = j + 1; j2 < tiersCount; j2++)
            {
                OpenIntObjectHashMap hsIntersections = new OpenIntObjectHashMap();
                for (int h = 0; h < hss.size(); h++)
                {
                    IHyperStructure hs = (IHyperStructure) hss.get(h);
                    OpenIntObjectHashMap nextTier = (OpenIntObjectHashMap) hs.getTiers().get(j2);
                    ObjectArrayList intersections = new ObjectArrayList();
                    hsIntersections.put(h, intersections);
                    for (int s = 0; s < nextTier.size(); s++)
                    {
                        ICompactTripletsStructure lastTierStructure = ((IVertex) verticesFromLastTiers.get(h)).getCTS();
                        IVertex nextTierVertex = (IVertex) nextTier.values().get(s);
                        ICompactTripletsStructure nextTierStructure = (ICompactTripletsStructure) nextTierVertex.getCTS().clone();
                        nextTierStructure.intersect(lastTierStructure);
                       
                        nextTierStructure.intersect((ICompactTripletsStructure) substructures.get(h));
                        intersections.add(nextTierStructure);
View Full Code Here

TOP

Related Classes of cern.colt.map.OpenIntObjectHashMap

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.