diff --git a/src/inport/TaskCase.java b/src/inport/TaskCase.java index 8ce85f1bea6556cf195c6dd94618e9a6e3a137f7..7a4a06fecaf6dd024a7620c0db7d1a96dcbaf1e8 100644 --- a/src/inport/TaskCase.java +++ b/src/inport/TaskCase.java @@ -74,6 +74,16 @@ public class TaskCase { // План - решение private List solution; + // Словесное описание. + private StringBuilder description; + + public StringBuilder getDescription() { + return description; + } + public void setDescription(StringBuilder description) { + this.description = description; + } + public List getFixedOperations() { return fixedOperations; } @@ -423,6 +433,7 @@ public class TaskCase { fixedOperations = new ArrayList<>(); solution = new ArrayList<>(); + description = new StringBuilder(); } private MovingObjectState fromString(String s, @@ -442,6 +453,7 @@ public class TaskCase { private enum Tag { Undefined (""), + Description ("Description"), Typified ("Typified"), Cargoes ("Cargoes"), Berths ("Berths"), @@ -485,6 +497,7 @@ public class TaskCase { bunkerTypes.clear(); fixedOperations.clear(); solution.clear(); + description = new StringBuilder(); // Open the file FileInputStream fstream; @@ -515,11 +528,17 @@ public class TaskCase { if (serviceString || strLine.trim().isEmpty() || tag==Tag.Undefined || strLine.startsWith("/*")) { numInside = 0; + if (tag.equals(Tag.Description) && ((strLine.trim().isEmpty()) || (strLine.startsWith("/*")))) { + description.append(strLine).append("\n"); + } continue; } String[] tokens; switch (tag) { + case Description: + description.append(strLine).append("\n"); + break; case Typified: typified = strLine.trim().equals("1"); break; case Cargoes: Cargo c = new Cargo(strLine); cargoes.add(c); m_cargo.put(c.getId(), c); @@ -747,6 +766,14 @@ public class TaskCase { try(FileWriter writer = new FileWriter(fileName, false)) { // запись всего + { + String d = description.toString(); + writer.write(Tag.Description.text + "\n" + d); + if ((d.isEmpty()) || ((d.length() > 1) && (d.charAt(d.length() - 2) != '\n'))) { + writer.write("\n"); + } + } + writer.write(Tag.Typified.text + "\n" + (isTypified()? "1" : "0") + "\n"); writer.write("\nCargoes"+"\n");