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

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

parent 43fbfdfd
......@@ -74,6 +74,16 @@ public class TaskCase {
// План - решение
private List<Operation> solution;
// Словесное описание.
private StringBuilder description;
public StringBuilder getDescription() {
return description;
}
public void setDescription(StringBuilder description) {
this.description = description;
}
public List<Operation> 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");
......
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