Esempio n. 1
0
        public IBranch AddBranch <T>(IBranch currentBranch, string name) where T : IBranch
        {
            var branch = _branchConstructor.Construct <T>(name, currentBranch);

            currentBranch.Branches.Add(branch);
            return(branch);
        }
Esempio n. 2
0
        public IBranch AddBranch <T>(ITree tree, string name, bool follow = false) where T : IBranch
        {
            IBranch branch;

            if (tree.CurrentBranch == null)
            {
                branch = _branchConstructor.Construct <T>(name, null);
                tree.Branches.Add(branch);
            }
            else
            {
                branch = _branchService.AddBranch <T>(tree.CurrentBranch, name);
            }

            if (follow)
            {
                tree.CurrentBranch = branch;
            }

            return(branch);
        }