From 279c47b5eb5eebf3e9f6f4b3fe21d3403f3371bd Mon Sep 17 00:00:00 2001 From: Vlad_kv Date: Thu, 8 Aug 2019 16:06:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=81=D0=BB=D0=BE=D0=B2=D0=B5=D1=81=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BA=20=D1=87=D0=B0=D1=81=D1=82=D1=8C=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B4=D0=B0=D1=87=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/inport/TaskCase.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/inport/TaskCase.java b/src/inport/TaskCase.java index 8ce85f1..7a4a06f 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"); -- GitLab