//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); } } } } } } } }
//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); }