|
|
|
@ -10,6 +10,7 @@ namespace EGFramework
@@ -10,6 +10,7 @@ namespace EGFramework
|
|
|
|
|
public IEGTree GetParent(); |
|
|
|
|
public void SetParent(IEGTree tree); |
|
|
|
|
public IEnumerable<IEGTree> GetChilds(); |
|
|
|
|
public IEGTree GetChild(string key); |
|
|
|
|
public void AppendTree(IEGTree tree); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -25,7 +26,7 @@ namespace EGFramework
@@ -25,7 +26,7 @@ namespace EGFramework
|
|
|
|
|
public bool BoolValue { set; get; } |
|
|
|
|
|
|
|
|
|
public IEGTree Parent { set; get; } |
|
|
|
|
public List<IEGTree> Childs { set; get; } = new List<IEGTree>(); |
|
|
|
|
public Dictionary<string,IEGTree> Childs { set; get; } = new Dictionary<string,IEGTree>(); |
|
|
|
|
|
|
|
|
|
public EGTree() |
|
|
|
|
{ |
|
|
|
@ -37,14 +38,32 @@ namespace EGFramework
@@ -37,14 +38,32 @@ namespace EGFramework
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void AppendTree(IEGTree tree) |
|
|
|
|
{ |
|
|
|
|
if (!Childs.ContainsKey(tree.Name)) |
|
|
|
|
{ |
|
|
|
|
tree.SetParent(this); |
|
|
|
|
Childs.Add(tree); |
|
|
|
|
Childs.Add(tree.Name,tree); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void AppendTree(string treeName) |
|
|
|
|
{ |
|
|
|
|
if (!Childs.ContainsKey(treeName)) |
|
|
|
|
{ |
|
|
|
|
EGTree newTree = new EGTree(treeName); |
|
|
|
|
newTree.SetParent(this); |
|
|
|
|
Childs.Add(treeName, newTree); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public bool Contains(string name) |
|
|
|
|
{ |
|
|
|
|
return Childs.ContainsKey(name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual IEnumerable<IEGTree> GetChilds() |
|
|
|
|
{ |
|
|
|
|
return Childs; |
|
|
|
|
return Childs.Values; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual IEGTree GetParent() |
|
|
|
@ -56,6 +75,18 @@ namespace EGFramework
@@ -56,6 +75,18 @@ namespace EGFramework
|
|
|
|
|
{ |
|
|
|
|
this.Parent = tree; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public IEGTree GetChild(string key) |
|
|
|
|
{ |
|
|
|
|
if (Childs.ContainsKey(key)) |
|
|
|
|
{ |
|
|
|
|
return Childs[key]; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static class EGTreeFactory |
|
|
|
|