Exemplo n.º 1
0
 public bool DeepEquals(DestinyPresentationNodeDefinition other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            (Children != null ? Children.DeepEquals(other.Children) : other.Children == null) &&
            DisableChildSubscreenNavigation == other.DisableChildSubscreenNavigation &&
            DisplayStyle == other.DisplayStyle &&
            MaxCategoryRecordScore == other.MaxCategoryRecordScore &&
            NodeType == other.NodeType &&
            Objective.DeepEquals(other.Objective) &&
            ParentNodes.DeepEqualsReadOnlyCollections(other.ParentNodes) &&
            PresentationNodeType == other.PresentationNodeType &&
            (Requirements != null ? Requirements.DeepEquals(other.Requirements) : other.Requirements == null) &&
            Scope == other.Scope &&
            ScreenStyle == other.ScreenStyle &&
            Traits.DeepEqualsReadOnlyCollections(other.Traits) &&
            TraitIds.DeepEqualsReadOnlySimpleCollection(other.TraitIds) &&
            OriginalIcon == other.OriginalIcon &&
            RootViewIcon == other.RootViewIcon &&
            CompletionRecord.DeepEquals(other.CompletionRecord) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Exemplo n.º 2
0
 public bool DeepEquals(DestinyRecordDefinition other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            CompletionInfo.DeepEquals(other.CompletionInfo) &&
            ExpirationInfo.DeepEquals(other.ExpirationInfo) &&
            IntervalInfo.DeepEquals(other.IntervalInfo) &&
            StateInfo.DeepEquals(other.StateInfo) &&
            TitleInfo.DeepEquals(other.TitleInfo) &&
            Objectives.DeepEqualsReadOnlyCollections(other.Objectives) &&
            ParentNodes.DeepEqualsReadOnlyCollections(other.ParentNodes) &&
            PresentationNodeType == other.PresentationNodeType &&
            RecordValueStyle == other.RecordValueStyle &&
            Requirements.DeepEquals(other.Requirements) &&
            RewardItems.DeepEqualsReadOnlyCollections(other.RewardItems) &&
            Scope == other.Scope &&
            Traits.DeepEqualsReadOnlyCollections(other.Traits) &&
            TraitIds.DeepEqualsReadOnlySimpleCollection(other.TraitIds) &&
            Lore.DeepEquals(other.Lore) &&
            PresentationInfo.DeepEquals(other.PresentationInfo) &&
            ForTitleGilding == other.ForTitleGilding &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Exemplo n.º 3
0
 private void RemoveParent(NodeControl node)
 {
     if (ParentNodes.Contains(node))
     {
         ParentNodes.Remove(node);
     }
 }
Exemplo n.º 4
0
 private void AddParent(NodeControl node)
 {
     if (!ParentNodes.Contains(node))
     {
         ParentNodes.Add(node);
     }
 }
 public void Remove()
 {
     if (ParentNodes != null)
     {
         ParentNodes.Remove(this);
         parentNodes = null;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SortedTree&lt;T&gt;.SortedTreeNode"/> class.
 /// </summary>
 /// <param name="ParentElementValue">The parent element value.</param>
 /// <param name="ParentTree">The parent tree.</param>
 /// <param name="ParentNode">The parent node.</param>
 /// <param name="ParentConnectorNumber">The parent connector number.</param>
 internal SortedTreeNode(T ParentElementValue, SortedTree <T> ParentTree, SortedTreeNode ParentNode, int ParentConnectorNumber)
 {
     MyParentTree = ParentTree;
     Value        = ParentElementValue;
     if (ParentNode != null)
     {
         ParentNodes.Add(ParentConnectorNumber, ParentNode);
     }
 }
Exemplo n.º 7
0
        private static Node Part1(string[] lines)
        {
            if (ParentNodes == null || ParentNodes.Count == 0)
            {
                ParentNodes = GetParentNodes(lines);
            }

            var firstParent = ParentNodes.First(n => ParentNodes.Count(c => c.Value.SubProgramNameList.Any(x => x.Equals(n.Value.Name))) == 0);

            return(firstParent.Value);
        }
        public override string ToString()
        {
            var parentNames = ParentNodes.Select(n => n.streamGraphNode);

            return("StreamsGraphNode{" +
                   "nodeName='" + streamGraphNode + '\'' +
                   ", buildPriority=" + BuildPriority +
                   ", hasWrittenToTopology=" + HasWrittenToTopology +
                   ", keyChangingOperation=" + KeyChangingOperation +
                   ", valueChangingOperation=" + ValueChangingOperation +
                   ", mergeNode=" + MergeNode +
                   ", parentNodes=" + string.Join(",", parentNames) + '}');
        }
Exemplo n.º 9
0
        public void AfterExploration(IPexExplorationComponent host, object data)
        {
            foreach (var vertex in Vertices.Values)
            {
                // Modifying shape based on Z3 calls
                if (Z3CallLocations.Contains(vertex.MethodName + ":" + vertex.ILOffset))
                {
                    vertex.Shape = SENode.NodeShape.Ellipse;
                }

                // Adding the path condition
                var t = PrettyPathConditionTasks[vertex.Id];
                t.Wait();
                vertex.PathCondition = t.Result;
            }

            foreach (var vertex in Vertices.Values)
            {
                // Adding the incremental path condition
                if (ParentNodes.ContainsKey(vertex.Id))
                {
                    vertex.IncrementalPathCondition = CalculateIncrementalPathCondition(vertex.PathCondition, Vertices[ParentNodes[vertex.Id]].PathCondition);
                }
                else
                {
                    // If the node is the first one (has no parents), then the incremental equals the full PC
                    vertex.IncrementalPathCondition = vertex.PathCondition;
                }
            }

            // Adding vertices and edges to the graph
            Graph.AddVertexRange(Vertices.Values);
            foreach (var edgeDictionary in Edges.Values)
            {
                Graph.AddEdgeRange(edgeDictionary.Values);
            }

            // Checking if temporary SEViz folder exists
            if (!Directory.Exists(Path.GetTempPath() + "SEViz"))
            {
                var dir = Directory.CreateDirectory(Path.GetTempPath() + "SEViz");
            }

            // Getting the temporary folder
            var tempDir = Path.GetTempPath() + "SEViz\\";

            // Serializing the graph into graphml
            SEGraph.Serialize(Graph, tempDir);
        }
Exemplo n.º 10
0
 public bool DeepEquals(DestinyMetricDefinition other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            LowerValueIsBetter == other.LowerValueIsBetter &&
            ParentNodes.DeepEqualsReadOnlyCollections(other.ParentNodes) &&
            PresentationNodeType == other.PresentationNodeType &&
            TrackingObjective.DeepEquals(other.TrackingObjective) &&
            Traits.DeepEqualsReadOnlyCollections(other.Traits) &&
            TraitIds.DeepEqualsReadOnlySimpleCollection(other.TraitIds) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
 public bool DeepEquals(DestinyCollectibleDefinition other)
 {
     return(other != null &&
            AcquisitionInfo.DeepEquals(other.AcquisitionInfo) &&
            (PresentationInfo != null ? PresentationInfo.DeepEquals(other.PresentationInfo) : other.PresentationInfo == null) &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            Item.DeepEquals(other.Item) &&
            ParentNodes.DeepEqualsReadOnlyCollections(other.ParentNodes) &&
            PresentationNodeType == other.PresentationNodeType &&
            Scope == other.Scope &&
            SourceHash == other.SourceHash &&
            SourceString == other.SourceString &&
            StateInfo.DeepEquals(other.StateInfo) &&
            Traits.DeepEqualsReadOnlyCollections(other.Traits) &&
            TraitIds.DeepEqualsReadOnlySimpleCollection(other.TraitIds) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Exemplo n.º 12
0
        public void QueueNodes(ICollection <DependencyNode <T> > nodes)
        {
            Visited = true;
            foreach (var parentNode in ParentNodes.OrderBy(x => x.OutgoingWeight))
            {
                if (parentNode.Visited)
                {
                    continue;
                }
                parentNode.QueueNodes(nodes);
            }
            nodes.Add(this);
            foreach (var childNode in ChildNodes.OrderBy(x => x.OutgoingWeight))
            {
                if (childNode.Visited)
                {
                    continue;
                }

                childNode.QueueNodes(nodes);
            }
        }
Exemplo n.º 13
0
        public void AfterRun(IPexPathComponent host, object data)
        {
            MessageBox.Show("AfterRun");

            // Getting the executions nodes in the current path
            var nodesInPath = host.PathServices.CurrentExecutionNodeProvider.ReversedNodes.Reverse().ToArray();

            // Getting the sequence id of the current run
            var runId = host.ExplorationServices.Driver.Runs;

            // Iterating over the nodes in the path
            foreach (var node in nodesInPath)
            {
                var vertex = new CFGNode(node.UniqueIndex, false);

                // Adding the method name this early in order to color edges
                string methodName = null;
                int    offset     = 0;
                if (node.CodeLocation.Method == null)
                {
                    if (node.InCodeBranch.Method != null)
                    {
                        methodName = node.InCodeBranch.Method.FullName;
                    }
                }
                else
                {
                    methodName = node.CodeLocation.Method.FullName;
                    offset     = node.CodeLocation.Offset;
                }
                // Setting the method name
                vertex.MethodName = methodName;

                // Setting the offset
                vertex.ILOffset = (uint)offset;

                var nodeIndex = nodesInPath.ToList().IndexOf(node);
                if (nodeIndex > 0)
                {
                    var prevNode = nodesInPath [nodeIndex - 1];
                    // If there is no edge between the previous and the current node
                    if (!(Edges.ContainsKey(prevNode.UniqueIndex) && Edges [prevNode.UniqueIndex].ContainsKey(node.UniqueIndex)))
                    {
                        var prevVertex = Vertices [prevNode.UniqueIndex];

                        var edge = new CFGEdge(new Random().Next(), prevVertex, vertex);

                        Dictionary <int, CFGEdge> outEdges = null;
                        if (Edges.TryGetValue(prevNode.UniqueIndex, out outEdges))
                        {
                            outEdges.Add(node.UniqueIndex, edge);
                        }
                        else
                        {
                            Edges.Add(prevNode.UniqueIndex, new Dictionary <int, CFGEdge>());
                            Edges [prevNode.UniqueIndex].Add(node.UniqueIndex, edge);
                        }

                        // Edge coloring based on unit border detection
                        if (UnitNamespace != null)
                        {
                            // Checking if pointing into the unit from outside
                            if (!(prevVertex.MethodName.StartsWith(UnitNamespace + ".") || prevVertex.MethodName.Equals(UnitNamespace)) && (vertex.MethodName.StartsWith(UnitNamespace + ".") || vertex.MethodName.Equals(UnitNamespace)))
                            {
                                edge.Color = CFGEdge.EdgeColor.Green;
                            }

                            // Checking if pointing outside the unit from inside
                            if ((prevVertex.MethodName.StartsWith(UnitNamespace + ".") || prevVertex.MethodName.Equals(UnitNamespace)) && !(vertex.MethodName.StartsWith(UnitNamespace + ".") || vertex.MethodName.Equals(UnitNamespace)))
                            {
                                edge.Color = CFGEdge.EdgeColor.Red;
                            }
                        }
                    }
                }

                // If the node is new then it is added to the list and the metadata is filled
                if (!Vertices.ContainsKey(node.UniqueIndex))
                {
                    Vertices.Add(node.UniqueIndex, vertex);

                    // Adding source code mapping
                    vertex.SourceCodeMappingString = MapToSourceCodeLocationString(host, node);

                    // Setting the border based on mapping existence
                    vertex.Border = vertex.SourceCodeMappingString == null ? CFGNode.NodeBorder.Single : CFGNode.NodeBorder.Double;

                    // Setting the color
                    if (nodesInPath.LastOrDefault() == node)
                    {
                        if (!EmittedTestResult.ContainsKey(runId))
                        {
                            vertex.Color = CFGNode.NodeColor.Orange;
                        }
                        else
                        {
                            if (EmittedTestResult [runId].Item1)
                            {
                                vertex.Color = CFGNode.NodeColor.Red;
                            }
                            else
                            {
                                vertex.Color = CFGNode.NodeColor.Green;
                            }
                            vertex.GenerateTestCode = EmittedTestResult [runId].Item2;
                        }
                    }
                    else
                    {
                        vertex.Color = CFGNode.NodeColor.White;
                    }

                    // Setting the default shape
                    vertex.Shape = CFGNode.NodeShape.Rectangle;

                    // Adding path condition tasks and getting the required services
                    TermEmitter       termEmitter      = new TermEmitter(host.GetService <TermManager>());
                    SafeStringWriter  safeStringWriter = new SafeStringWriter();
                    IMethodBodyWriter methodBodyWriter = host.GetService <IPexTestManager>().Language.CreateBodyWriter(safeStringWriter, VisibilityContext.Private, 2000);
                    PrettyPathConditionTasks.Add(vertex.Id, PrettyPrintPathCondition(termEmitter, methodBodyWriter, safeStringWriter, node));

                    // Setting the status
                    vertex.Status = node.ExhaustedReason.ToString();

                    // Collecting the parent nodes for the later incremental path condition calculation
                    if (nodeIndex > 0)
                    {
                        ParentNodes.Add(vertex.Id, nodesInPath [nodeIndex - 1].UniqueIndex);
                    }
                }

                // Adding the Id of the run
                Vertices [node.UniqueIndex].Runs += (runId + ";");
            }
        }
Exemplo n.º 14
0
 internal string[] ParentNodeNames() => ParentNodes.Select(p => p.streamGraphNode).ToArray();
Exemplo n.º 15
0
 public void AddNode(Node node)
 {
     ParentNodes.Add(node);
 }