Commit 10add7b3 authored by Vladislav Kiselev's avatar Vladislav Kiselev

Обновлён формат тестов, исправлено пару багов.

parent 62bd0d72
......@@ -4,10 +4,7 @@
*/
package inport;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.*;
/**
*
......@@ -17,14 +14,14 @@ public class CargoFlow {
private Storage storage;
private Cargo cargo;
Map<Double, Double> flow;
SortedMap<Double, Double> flow;
public Map<Double, Double> getFlow() {
return flow;
}
public void setFlow(Map<Double, Double> flow) {
this.flow = flow;
this.flow = new TreeMap<>(flow);
}
/**
......@@ -54,7 +51,7 @@ public class CargoFlow {
}
public CargoFlow() {
this.flow = new HashMap<>();
this.flow = new TreeMap<>();
}
public CargoFlow(Storage storage, Cargo cargo) {
......@@ -71,7 +68,7 @@ public class CargoFlow {
double prevKey = -1.0;
for (Double keyTime : keyTimes)
{
if (forTime>=prevKey && forTime<keyTime)
if (forTime >= prevKey && forTime<keyTime)
{
res = flow.get(prevKey);
isFound = true;
......@@ -92,7 +89,7 @@ public class CargoFlow {
double prevKey = -1.0;
for (Double keyTime : keyTimes)
{
if (forTime>prevKey && forTime<keyTime)
if (forTime >= prevKey && forTime<keyTime)
{
res += flow.get(prevKey)*(forTime-prevKey);
isFound = true;
......@@ -103,7 +100,7 @@ public class CargoFlow {
prevKey = keyTime;
}
}
if (!isFound && forTime>prevKey)
if (!isFound && forTime >= prevKey)
res += flow.get(prevKey)*(forTime-prevKey);
return res;
}
......
......@@ -478,7 +478,7 @@ public class ConversionUtil {
// TODO ресурсы у операции погрузки.
operationsResources.set(i, s);
operationsStartLoc.set(i, getLocNById.apply(op.getStartLocation().getId(), true) + 1);
operationsStartLoc.set(i, getLocNById.apply(op.getStartLocation().getId(), op.getWithMooring()) + 1);
}
// TODO швартовка, погрузка.
}
......@@ -616,7 +616,7 @@ public class ConversionUtil {
LoadingTemplate op = (LoadingTemplate) operationTemplates.get(i);
int storageN = storNById.get(op.getStorage().getId());
int shipN = mObjToN.apply(op.getLoader());
int cargoN = cargoNById.get(op.getStorage().getCargo().getId());// TODO в TaskCase пока не реализовано, пересмотреть.
int cargoN = cargoNById.get(op.getCargo().getId());
loadingOpDelta.add(-(int)op.getIntensity());
loadingOpN.add(i);
......
......@@ -17,7 +17,8 @@ public class LoadingTemplate extends OperationTemplate {
private Storage storage;
private List<LoadingEquipment> resources;
private double intensity;
private boolean withMooring;
private Cargo cargo;
/**
* Get the value of resources
......@@ -61,6 +62,22 @@ public class LoadingTemplate extends OperationTemplate {
this.storage = storage;
}
public void setWithMooring(boolean withMooring) {
this.withMooring = withMooring;
}
public boolean getWithMooring() {
return withMooring;
}
public void setCargo(Cargo cargo) {
this.cargo = cargo;
}
public Cargo getCargo() {
return cargo;
}
public LoadingTemplate(TransportShip loader, Berth berth, Storage storage, double intensity, int id) {
super(id, berth);
this.loader = loader;
......
This diff is collapsed.
......@@ -31,7 +31,7 @@ Templates
201; mrn; []; 11; 5; []; 1
202; unm; []; 11; 5; []; 1
301; loa; []; 1001; 0; 11; 5; []; 2
301; loa; []; 1001; 0; 11; 5; []; 2; M
Cargo Flows
Initial Vessel State
......
......@@ -16,7 +16,7 @@ Templates
103; mov; []; 11; 1; 2;[]; 1
201; mrn; []; 11; 2; []; 1
202; unm; []; 11; 2; []; 1
301; loa; []; 1001; 0; 11; 2; []; 1
301; loa; []; 1001; 0; 11; 2; []; 1; M
Cargo Flows
1001; 0; [0:0, 5:1, 8:0]
......
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