public void DeleteFollow(FollowTable followTable)
 {
     using (var db = new CooksContext())
     {
         db.Entry(followTable).State = Microsoft.EntityFrameworkCore.EntityState.Deleted;
         db.SaveChanges();
     }
 }
Beispiel #2
0
        public TreeDetails(ExpressionTree tree, FollowTable follows, TransitionTable transitions)
        {
            InitializeComponent();
            this.tree        = tree;
            this.follows     = follows;
            this.transitions = transitions;

            expressionTextBox.Text = tree.expression;
        }
Beispiel #3
0
        public ActionResult Follow(string username)
        {
            var follow    = new FollowTable();
            var following = _repoUser.Get(x => x.UserName == username).First();

            follow.UserId     = following.Id;
            follow.FollowerId = (Int32)Session["UserId"];
            _repoFollowTable.Add(follow);
            _repoFollowTable.SaveChanges();
            return(Redirect("/User/Profile?username=" + username));
        }
Beispiel #4
0
            /// <exception cref="NotComputedException"></exception>
            public static FollowComputer Compute(LL1Algo algo)
            {
                _ = algo.Nullable ?? throw new NotComputedException(nameof(algo.Nullable));
                _ = algo.First ?? throw new NotComputedException(nameof(algo.First));

                var iterations = new List <FollowTable>();

                var follow = new FollowTable();

                // initialize first iteration
                foreach (var A in algo.Thecfg.Nonterminals)
                {
                    follow.Add(A, new FollowResult());
                }
                do
                {
                    if (iterations.Count == 0)
                    {
                        iterations.Add(follow);
                    }
                    else
                    {
                        iterations.Add(DictUtil.Clone(follow));
                    }
                    follow = iterations.Last();
                    foreach (var prod in algo.Thecfg.Productions)
                    {
                        for (int i = 0; i < prod.Rhs.Count; ++i)
                        {
                            var Bi = prod.Rhs[i];
                            if (Bi.Type == Symbol.Types.NonTerminal)
                            {
                                // test Bi+1,...,Bk
                                var rest = prod.Rhs.Skip(i + 1);
                                follow[Bi].UnionWith(algo.First.Sequence(rest));
                                if (rest.All(e => e.Type == Symbol.Types.NonTerminal && algo.Nullable[e]) ||
                                    i == prod.Rhs.Count - 1)
                                {
                                    follow[Bi].UnionWith(follow[prod.Lhs]);
                                }
                            }
                        }
                    }
                    // stop loop if no changes between iterations
                } while (iterations.Count == 1 ||
                         !DictUtil.Equal(follow, iterations[iterations.Count - 2]));

                return(new FollowComputer(algo, iterations));
            }
Beispiel #5
0
        private void detailsButton_Click(object sender, EventArgs e)
        {
            try
            {
                FollowTable     follows     = new FollowTable(tree);
                TransitionTable transitions = new TransitionTable(follows);

                TreeDetails window = new TreeDetails(tree, follows, transitions);
                window.Show();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
 public void DeleteFollow(FollowTable followTable)
 {
     _userDAL.DeleteFollow(followTable);
 }
 public void AddFollow(FollowTable followTable)
 {
     _userDAL.AddFollow(followTable);
 }
 public IActionResult AddFollow(FollowTable followTable)
 {
     _userService.AddFollow(followTable);
     return(Ok());
 }
Beispiel #9
0
 public void AddFollower(FollowTable follow)
 {
 }