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); } } }
public SimplePointsToGraph Join(SimplePointsToGraph ptg) { var result = this.Clone(); this.Union(ptg); return(result); }
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); }
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); }
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)); }