Переопределён метод toString()

This commit is contained in:
Victor 2013-11-26 10:01:41 +02:00
parent 47162bbd68
commit aa6f48f447

View File

@ -55,9 +55,14 @@ public class NotePad {
this.important = important; this.important = important;
} }
@Override
public String toString() {
return getName() + ". " + getDescription();
}
public static NotePad readFromCsvLine(String line) throws ParseException { public static NotePad readFromCsvLine(String line) throws ParseException {
if (line.isEmpty()) throw new RuntimeException("Пустая строка"); if (line.isEmpty()) throw new RuntimeException("Пустая строка");
String[] params = line.split(","); String[] params = line.split("\t");
if (params.length != 4) throw new RuntimeException("Неверное количество параметров"); if (params.length != 4) throw new RuntimeException("Неверное количество параметров");
String name = params[0]; String name = params[0];
@ -69,7 +74,7 @@ public class NotePad {
} }
public String storeToCsvLine() { public String storeToCsvLine() {
final char SEPARATOR = ','; final char SEPARATOR = '\t';
return name + SEPARATOR + return name + SEPARATOR +
description + SEPARATOR + description + SEPARATOR +
new SimpleDateFormat(DATE_PATTERN).format(date) + SEPARATOR + new SimpleDateFormat(DATE_PATTERN).format(date) + SEPARATOR +