/// <summary> /// Create an exact copy of the given tree branch but replace all leaf values of type T1 by values /// of type T2 using the given cast function /// </summary> /// <typeparam name="T1"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="treeBranch"></param> /// <param name="castFunc"></param> /// <returns></returns> public static SimpleTreeBranch <T2> Cast <T1, T2>(this SimpleTreeBranch <T1> treeBranch, Func <T1, T2> castFunc) { return(new SimpleTreeBranch <T2>( treeBranch.BranchIndex, treeBranch.BranchName, treeBranch.BranchType, Cast(treeBranch.BranchNode, castFunc) )); }
/// <summary> /// Create an exact copy of the given tree branch but replace all leaf values of type T1 by values /// of type string using the ToString() method /// </summary> /// <typeparam name="T1"></typeparam> /// <param name="treeBranch"></param> /// <returns></returns> public static SimpleTreeBranch <string> ToStringTree <T1>(this SimpleTreeBranch <T1> treeBranch) { return(new SimpleTreeBranch <string>( treeBranch.BranchIndex, treeBranch.BranchName, treeBranch.BranchType, ToStringTree(treeBranch.BranchNode) )); }
/// <summary> /// Create an exact copy of the given tree branch but replace all leaf values of type T1 by values /// of type T2 using the as operator /// </summary> /// <typeparam name="T1"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="treeBranch"></param> /// <returns></returns> public static SimpleTreeBranch <T2> Cast <T1, T2>(this SimpleTreeBranch <T1> treeBranch) where T1 : class where T2 : class { return(new SimpleTreeBranch <T2>( treeBranch.BranchIndex, treeBranch.BranchName, treeBranch.BranchType, Cast <T1, T2>(treeBranch.BranchNode) )); }
public bool Remove(SimpleTreeBranch <TLeaf> item) { throw new NotImplementedException(); }
public bool Contains(SimpleTreeBranch <TLeaf> item) { throw new NotImplementedException(); }
public void Add(SimpleTreeBranch <TLeaf> item) { _branches.Add(item); }
public void Add(string branchName, string branchType, SimpleTreeNode <TLeaf> branchNode) { var item = new SimpleTreeBranch <TLeaf>(_branches.Count, branchName, branchType, branchNode); _branches.Add(item); }
public void Insert(int index, SimpleTreeBranch <TLeaf> item) { _branches.Insert(index, item); }
public int IndexOf(SimpleTreeBranch <TLeaf> item) { throw new NotImplementedException(); }
public bool TryGetValue(int key, out SimpleTreeBranch <TLeaf> value) { return(_branches.TryGetValue(key, out value)); }
public void Add(int key, SimpleTreeBranch <TLeaf> value) { _branches.Add(key, value); }
public void Add(SimpleTreeBranch <TLeaf> branch) { _branches.Add(branch.BranchIndex, branch); }
public void Add(int branchIndex, string branchName, string branchType, SimpleTreeNode <TLeaf> branchValue) { var branch = new SimpleTreeBranch <TLeaf>(branchIndex, branchName, branchType, branchValue); _branches.Add(branchIndex, branch); }