diff --git a/ueb05_news_example/src/client/Client.java b/ueb05_news_example/src/client/Client.java index 383d49a0..6eb897db 100644 --- a/ueb05_news_example/src/client/Client.java +++ b/ueb05_news_example/src/client/Client.java @@ -6,7 +6,7 @@ import model.NewsCollection; public class Client { - public static void main(String[] args) { + public static void main() { NewsCollection masterCollection = new NewsCollection("Daily news"); masterCollection.addItem(new NewsCollection("Sports") .addItem(new Article("Harder, Better, Faster, Stronger. Doping controls loosened","ups")) diff --git a/ueb05_news_example/src/model/Article.java b/ueb05_news_example/src/model/Article.java index f126bf21..80e20cf0 100644 --- a/ueb05_news_example/src/model/Article.java +++ b/ueb05_news_example/src/model/Article.java @@ -11,8 +11,8 @@ public class Article extends AuthoredItem { /** * Creates an article with the given title and author. - * @param title - * @param author + * @param title title of article + * @param author author of article */ public Article(String title, String author) { this.title = title; diff --git a/ueb05_news_example/src/model/AuthoredItem.java b/ueb05_news_example/src/model/AuthoredItem.java index 2ab22537..35f457bc 100644 --- a/ueb05_news_example/src/model/AuthoredItem.java +++ b/ueb05_news_example/src/model/AuthoredItem.java @@ -22,6 +22,7 @@ public abstract class AuthoredItem extends Item{ /** * Get the content of the AuthoredItem. + * * @return content */ public String getContent() { diff --git a/ueb05_news_example/src/model/Image.java b/ueb05_news_example/src/model/Image.java index 8fdd094b..4b018e63 100644 --- a/ueb05_news_example/src/model/Image.java +++ b/ueb05_news_example/src/model/Image.java @@ -1,8 +1,8 @@ package model; public class Image extends AuthoredItem { - private int width; - private int height; + private final int width; + private final int height; // Fill in dummy content { @@ -13,10 +13,10 @@ public class Image extends AuthoredItem { * Creates an image with the given title and author and a resolution * defined by width and height. * - * @param title - * @param width - * @param height - * @param author + * @param title title of image + * @param width width of image + * @param height height of image + * @param author author of image */ public Image(String title, int width, int height, String author) { this.title = title; diff --git a/ueb05_news_example/src/model/NewsCollection.java b/ueb05_news_example/src/model/NewsCollection.java index 719d918f..975d75a9 100644 --- a/ueb05_news_example/src/model/NewsCollection.java +++ b/ueb05_news_example/src/model/NewsCollection.java @@ -4,9 +4,9 @@ import java.util.LinkedList; import java.util.List; public class NewsCollection extends Item { - - private List items = new LinkedList<>(); - + + private final List items = new LinkedList<>(); + public NewsCollection(String title) { this.title = title; } @@ -17,11 +17,13 @@ public class NewsCollection extends Item { */ public String getOverview(){ StringBuilder builder = new StringBuilder(); - builder.append("###" + getTitle() + "###"); - builder.append("\n"); + builder + .append("###").append(getTitle()).append("###") + .append("\n"); for(Item item : getItems()){ - builder.append(item.getOverview()); - builder.append("\n"); + builder + .append(item.getOverview()) + .append("\n"); } return builder.toString(); } @@ -32,8 +34,9 @@ public class NewsCollection extends Item { */ public String getDetails(){ StringBuilder builder = new StringBuilder(); - builder.append("###" + getTitle() + "###"); - builder.append("\n"); + builder + .append("###").append(getTitle()).append("###") + .append("\n"); for (Item item : getItems()) { builder.append(item.getDetails()); } @@ -52,7 +55,7 @@ public class NewsCollection extends Item { /** * Store an item directly in this collection. - * @param item + * @param item to add * @return this collection (enables method chaining) */ public NewsCollection addItem(Item item) {