Beispiel #1
0
 //constructor for blog with recieving the author name
 public Blogs(String owner)
 {
     this.OWNER         = owner;
     this.id            = Guid.NewGuid();
     this.my_list_posts = new LinkedList <Post>();
     AllBlogs.getAllblogs().AddBlog(this);
 }
Beispiel #2
0
        //function for each blogger that can find all the comments made by a specific author
        public void allCommentsFromAuthor(String author)
        {
            //get the singletone linked list
            AllBlogs           SERVERBLOG    = AllBlogs.getAllblogs();
            LinkedList <Blogs> my_list_Blogs = SERVERBLOG.getBlogList();

            //loop for each blogger inside his post and look for comments with the same title as recieved in the function "author"
            if (my_list_Blogs != null)
            {
                foreach (Blogs blogs in my_list_Blogs)
                {
                    if (blogs.my_list_posts != null)
                    {
                        foreach (Post posts in blogs.my_list_posts)
                        {
                            if (posts.my_list_comment != null)
                            {
                                foreach (Comment comment in posts.my_list_comment)
                                {
                                    if (author.Equals(comment.AUTHOR))
                                    {
                                        Console.WriteLine(comment.BODY_TEXT);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        //get the instance for the Allblogs
        public static AllBlogs getAllblogs()
        {
            if (instance == null)
            {
                instance = new AllBlogs();
            }

            return(instance);
        }