Commit 279c47b5 authored by Vladislav Kiselev's avatar Vladislav Kiselev

Добавлено словесное описание как часть задачи.

parent 43fbfdfd
...@@ -74,6 +74,16 @@ public class TaskCase { ...@@ -74,6 +74,16 @@ public class TaskCase {
// План - решение // План - решение
private List<Operation> solution; private List<Operation> solution;
// Словесное описание.
private StringBuilder description;
public StringBuilder getDescription() {
return description;
}
public void setDescription(StringBuilder description) {
this.description = description;
}
public List<Operation> getFixedOperations() { public List<Operation> getFixedOperations() {
return fixedOperations; return fixedOperations;
} }
...@@ -423,6 +433,7 @@ public class TaskCase { ...@@ -423,6 +433,7 @@ public class TaskCase {
fixedOperations = new ArrayList<>(); fixedOperations = new ArrayList<>();
solution = new ArrayList<>(); solution = new ArrayList<>();
description = new StringBuilder();
} }
private MovingObjectState fromString(String s, private MovingObjectState fromString(String s,
...@@ -442,6 +453,7 @@ public class TaskCase { ...@@ -442,6 +453,7 @@ public class TaskCase {
private enum Tag { private enum Tag {
Undefined (""), Undefined (""),
Description ("Description"),
Typified ("Typified"), Typified ("Typified"),
Cargoes ("Cargoes"), Cargoes ("Cargoes"),
Berths ("Berths"), Berths ("Berths"),
...@@ -485,6 +497,7 @@ public class TaskCase { ...@@ -485,6 +497,7 @@ public class TaskCase {
bunkerTypes.clear(); bunkerTypes.clear();
fixedOperations.clear(); fixedOperations.clear();
solution.clear(); solution.clear();
description = new StringBuilder();
// Open the file // Open the file
FileInputStream fstream; FileInputStream fstream;
...@@ -515,11 +528,17 @@ public class TaskCase { ...@@ -515,11 +528,17 @@ public class TaskCase {
if (serviceString || strLine.trim().isEmpty() || tag==Tag.Undefined || strLine.startsWith("/*")) if (serviceString || strLine.trim().isEmpty() || tag==Tag.Undefined || strLine.startsWith("/*"))
{ {
numInside = 0; numInside = 0;
if (tag.equals(Tag.Description) && ((strLine.trim().isEmpty()) || (strLine.startsWith("/*")))) {
description.append(strLine).append("\n");
}
continue; continue;
} }
String[] tokens; String[] tokens;
switch (tag) { switch (tag) {
case Description:
description.append(strLine).append("\n");
break;
case Typified: typified = strLine.trim().equals("1"); case Typified: typified = strLine.trim().equals("1");
break; break;
case Cargoes: Cargo c = new Cargo(strLine); cargoes.add(c); m_cargo.put(c.getId(), c); case Cargoes: Cargo c = new Cargo(strLine); cargoes.add(c); m_cargo.put(c.getId(), c);
...@@ -747,6 +766,14 @@ public class TaskCase { ...@@ -747,6 +766,14 @@ public class TaskCase {
try(FileWriter writer = new FileWriter(fileName, false)) 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(Tag.Typified.text + "\n" + (isTypified()? "1" : "0") + "\n");
writer.write("\nCargoes"+"\n"); writer.write("\nCargoes"+"\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment