Ejemplo n.º 1
0
        public void Union(SimplePointsToGraph ptg)
        {
            if (stackFrame.Count != ptg.stackFrame.Count)
            {
            }
            // We assume they have the same stack frame
            if (this.stackFrame == null && ptg.stackFrame != null)
            {
                this.stackFrame = new Stack <MapSet <IVariable, PTGNode> >(ptg.stackFrame.Reverse());
            }

            this.nodes.UnionWith(ptg.nodes);
            this.roots.UnionWith(ptg.roots);
            this.edges.UnionWith(ptg.edges);

            // Recompute Variables
            // add variable <---> node edges
            foreach (var entry in this.roots)
            {
                foreach (var n in entry.Value)
                {
                    n.Variables.Add(entry.Key);
                }
            }
        }
Ejemplo n.º 2
0
        public SimplePointsToGraph Join(SimplePointsToGraph ptg)
        {
            var result = this.Clone();

            this.Union(ptg);
            return(result);
        }
Ejemplo n.º 3
0
        public SimplePointsToGraph ShalowClone()
        {
            var ptg = new SimplePointsToGraph();

            ptg.stackFrame = this.stackFrame;
            ptg.roots      = this.roots;
            ptg.nodes      = this.nodes;
            ptg.edges      = this.edges;
            return(ptg);
        }
Ejemplo n.º 4
0
        public SimplePointsToGraph Clone()
        {
            var ptg = new SimplePointsToGraph();

            ptg.stackFrame = new Stack <MapSet <IVariable, PTGNode> >(this.stackFrame.Reverse());
            ptg.roots      = new MapSet <IVariable, PTGNode>(this.roots);
            ptg.nodes      = new HashSet <PTGNode>(this.nodes);
            ptg.edges      = new MapSet <NodeField, PTGNode>(this.edges);
            return(ptg);
        }
Ejemplo n.º 5
0
 public bool GraphLessEquals(SimplePointsToGraph other)
 {
     if (object.ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other != null &&
            this.roots.MapLessEquals(other.roots) &&
            this.nodes.IsSubsetOf(other.nodes) &&
            this.edges.MapLessEquals(other.edges));
 }