-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add diagnostic for ApplicationEngine (#2613)
- Loading branch information
Showing
7 changed files
with
132 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (C) 2015-2021 The Neo Project. | ||
// | ||
// The neo is free software distributed under the MIT software license, | ||
// see the accompanying file LICENSE in the main directory of the | ||
// project or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Neo.IO.Caching | ||
{ | ||
public class Tree<T> | ||
{ | ||
public TreeNode<T> Root { get; private set; } | ||
|
||
public TreeNode<T> AddRoot(T item) | ||
{ | ||
if (Root is not null) | ||
throw new InvalidOperationException(); | ||
Root = new TreeNode<T>(item, null); | ||
return Root; | ||
} | ||
|
||
public IEnumerable<T> GetItems() | ||
{ | ||
if (Root is null) yield break; | ||
foreach (T item in Root.GetItems()) | ||
yield return item; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (C) 2015-2021 The Neo Project. | ||
// | ||
// The neo is free software distributed under the MIT software license, | ||
// see the accompanying file LICENSE in the main directory of the | ||
// project or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Neo.IO.Caching | ||
{ | ||
public class TreeNode<T> | ||
{ | ||
public T Item { get; } | ||
public TreeNode<T> Parent { get; } | ||
|
||
private readonly List<TreeNode<T>> children = new(); | ||
|
||
internal TreeNode(T item, TreeNode<T> parent) | ||
{ | ||
Item = item; | ||
Parent = parent; | ||
} | ||
|
||
public TreeNode<T> AddChild(T item) | ||
{ | ||
TreeNode<T> child = new(item, this); | ||
children.Add(child); | ||
return child; | ||
} | ||
|
||
internal IEnumerable<T> GetItems() | ||
{ | ||
yield return Item; | ||
foreach (var child in children) | ||
foreach (T item in child.GetItems()) | ||
yield return item; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2015-2021 The Neo Project. | ||
// | ||
// The neo is free software distributed under the MIT software license, | ||
// see the accompanying file LICENSE in the main directory of the | ||
// project or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using Neo.IO.Caching; | ||
|
||
namespace Neo.SmartContract | ||
{ | ||
public class Diagnostic | ||
{ | ||
public Tree<UInt160> InvocationTree { get; } = new(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters