diff --git a/src/inport/CargoFlow.java b/src/inport/CargoFlow.java index cdc5459fd15b96fb1498ef0c322dd7e9355899c0..b26658423ad29c4256f28842ccd8bf79a9bb3c10 100644 --- a/src/inport/CargoFlow.java +++ b/src/inport/CargoFlow.java @@ -7,6 +7,7 @@ package inport; import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.TreeMap; /** * @@ -59,7 +60,7 @@ public class CargoFlow { public CargoFlow(Storage storage, Cargo cargo) { this.storage = storage; this.cargo = cargo; - this.flow = new HashMap<>(); + this.flow = new TreeMap<>(); } public double getCurrentValue(double forTime) @@ -70,7 +71,7 @@ public class CargoFlow { double prevKey = -1.0; for (Double keyTime : keyTimes) { - if (forTime>prevKey && forTime=prevKey && forTimeprevKey) + if (!isFound && forTime >= prevKey) res = flow.get(prevKey); return res; } @@ -123,7 +124,7 @@ public class CargoFlow { } public CargoFlow(String s, Map mp, Map cp) { - this.flow = new HashMap<>(); + this.flow = new TreeMap<>(); String[] tokens = s.split(";"); int key = Integer.parseInt(tokens[0].trim()); storage = mp.get(key); diff --git a/src/inport/ConversionUtil.java b/src/inport/ConversionUtil.java index d4405875a9640f5fe56ea13f23c90d8d061e664c..18e499ab150e8ea38994ec9b9ad5208748299e8e 100644 --- a/src/inport/ConversionUtil.java +++ b/src/inport/ConversionUtil.java @@ -465,7 +465,7 @@ public class ConversionUtil { int storageN = storNById.get(flow.getStorage().getId()); int cargoN = cargoNById.get(flow.getCargo().getId()); for (int i = 1; i < n_intervals + 2; i++) { - cargoFlows.get(storageN + movingObjects.size()).get(i).set(cargoN, (int)flow.getCurrentValue(i)); + cargoFlows.get(storageN + movingObjects.size()).get(i).set(cargoN, (int)flow.getCurrentValue(i - 0.1)); } } writer.write("cargo_flows = array3d(1..n_obj_with_storage, 0..(n_intervals + 1), 1..n_cargo_types, ["); @@ -501,7 +501,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 = 0; // TODO в TaskCase пока не реализовано, пересмотреть. + int cargoN = cargoNById.get(op.getStorage().getCargo().getId());// TODO в TaskCase пока не реализовано, пересмотреть. loadingOpDelta.add(-(int)op.getIntensity()); loadingOpN.add(i);