//
        // Look at all nodes in the graph. If we can combine this atomic region with any region, add edges and nodes.
        //
        private void RegionComposition(Region currAtomRegion, List <ShapeRegion> shapeRegions, Queue <Region> worklist)
        {
            AtomicRegion atom = currAtomRegion.atoms[0];

            // Look at all nodes in the graph
            int graphSize = graph.Size();

            for (int n = 0; n < graphSize; n++)
            {
                Region node = graph.vertices[n].data;

                // If the region in the graph does NOT have this atom, perform construction.
                if (!node.HasAtom(atom))
                {
                    // Make the sum-set of atoms.
                    List <AtomicRegion> sumAtoms = new List <AtomicRegion>(node.atoms);
                    sumAtoms.Add(atom);

                    // Construct the shape: Shape = atoms + atom
                    Region sumRegion = GetShapeRegion(shapeRegions, sumAtoms);
                    if (sumRegion == null)
                    {
                        sumRegion = new Region(sumAtoms);
                    }

                    // Add to the worklist if we have added something new.
                    if (CreateAddNodesEdges(sumRegion, node, currAtomRegion))
                    {
                        // Add the smaller regions to the worklist.
                        worklist.Enqueue(sumRegion);
                    }
                }
            }
        }
Esempio n. 2
0
        public override bool Equals(Object obj)
        {
            Region thatRegion = obj as Region;

            if (thatRegion == null)
            {
                return(false);
            }

            if (this.atoms.Count != thatRegion.atoms.Count)
            {
                return(false);
            }

            foreach (Atomizer.AtomicRegion atom in atoms)
            {
                if (!thatRegion.HasAtom(atom))
                {
                    return(false);
                }
            }

            return(true);
        }