@@ -0,0 +1,1970 @@
+package tars.ui;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport tars.model.tag.ReadOnlyTag;%0A%0Apublic class Formatter %7B%0A    /** Format of indexed list item */%0A    private static final String MESSAGE_INDEXED_LIST_ITEM = %22%5Ct%251$d. %252$s%22;%0A%0A    /** A decorative prefix added to the beginning of lines printed by TARS */%0A    private static final String LINE_PREFIX = %22 %22;%0A%0A    /** A platform independent line separator. */%0A    private static final String LS = System.lineSeparator();%0A%0A    /** Offset required to convert between 1-indexing and 0-indexing. */%0A    private static final int DISPLAYED_INDEX_OFFSET = 1;%0A%0A    public String formatTags(List%3C? extends ReadOnlyTag%3E tags) %7B%0A        final List%3CString%3E formattedTags = new ArrayList%3C%3E();%0A        for (ReadOnlyTag tag : tags) %7B%0A            formattedTags.add(tag.getAsText());%0A        %7D%0A        return format(asIndexedList(formattedTags));%0A    %7D%0A%0A    /** Formats the given strings for displaying to the user. */%0A    public String format(String... messages) %7B%0A        StringBuilder sb = new StringBuilder();%0A        for (String m : messages) %7B%0A            sb.append(LINE_PREFIX + m.replace(%22%5Cn%22, LS + LINE_PREFIX) + LS);%0A        %7D%0A        return sb.toString();%0A    %7D%0A%0A    /** Formats a list of strings as an indexed list. */%0A    private static String asIndexedList(List%3CString%3E listItems) %7B%0A        final StringBuilder formatted = new StringBuilder();%0A        int displayIndex = 0 + DISPLAYED_INDEX_OFFSET;%0A        for (String listItem : listItems) %7B%0A            formatted.append(getIndexedListItem(displayIndex, listItem)).append(%22%5Cn%22);%0A            displayIndex++;%0A        %7D%0A        return formatted.toString();%0A    %7D%0A%0A    /**%0A     * Formats a string as an indexed list item.%0A     *%0A     * @param visibleIndex index for this listing%0A     */%0A    private static String getIndexedListItem(int visibleIndex, String listItem) %7B%0A        return String.format(MESSAGE_INDEXED_LIST_ITEM, visibleIndex, listItem);%0A    %7D%0A%7D%0A

Add formatter for tag