修改股道视图删除数据bug
This commit is contained in:
parent
a8a5a4c884
commit
dca02becfc
@ -103,9 +103,10 @@ public class CTCLogicLoop {
|
|||||||
private void trackViewUpdate(Simulation simulation) {
|
private void trackViewUpdate(Simulation simulation) {
|
||||||
CtcRepository ctcRepository = simulation.getCtcRepository();
|
CtcRepository ctcRepository = simulation.getCtcRepository();
|
||||||
for (TrackView trackView : ctcRepository.getTrackViewMap().values()) {
|
for (TrackView trackView : ctcRepository.getTrackViewMap().values()) {
|
||||||
Set<String> deleteTripNumbers = new HashSet<>();
|
|
||||||
for (Map<String, TrackView.Line> lineMap : trackView.getTrackLineMap().values()) {
|
for (Map<String, TrackView.Line> lineMap : trackView.getTrackLineMap().values()) {
|
||||||
for (TrackView.Line line : lineMap.values()) {
|
Iterator<TrackView.Line> lineIterator = lineMap.values().iterator();
|
||||||
|
while (lineIterator.hasNext()) {
|
||||||
|
TrackView.Line line = lineIterator.next();
|
||||||
int remain = line.getRemain2Delete();
|
int remain = line.getRemain2Delete();
|
||||||
if (remain == -1) {
|
if (remain == -1) {
|
||||||
TrackView.Process process = line.getProcess();
|
TrackView.Process process = line.getProcess();
|
||||||
@ -115,16 +116,13 @@ public class CTCLogicLoop {
|
|||||||
} else {
|
} else {
|
||||||
remain -= LOGIC_RATE;
|
remain -= LOGIC_RATE;
|
||||||
if (remain <= 0) {
|
if (remain <= 0) {
|
||||||
deleteTripNumbers.add(line.getTripNumber());
|
lineIterator.remove();
|
||||||
} else {
|
} else {
|
||||||
line.setRemain2Delete(remain);
|
line.setRemain2Delete(remain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String tn : deleteTripNumbers) {
|
|
||||||
trackView.getTrackLineMap().remove(tn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.CTC.data;
|
package club.joylink.rtss.simulation.cbtc.CTC.data;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -244,18 +245,14 @@ public class TrackView {
|
|||||||
|
|
||||||
public boolean isArrive() {
|
public boolean isArrive() {
|
||||||
if (receivingRoute != null) {
|
if (receivingRoute != null) {
|
||||||
if (StringUtils.hasText(receivingRoute.getItem().getActualTime())) {
|
return receivingRoute.getItem().isFinish();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeparture() {
|
public boolean isDeparture() {
|
||||||
if (departureRoute != null) {
|
if (departureRoute != null) {
|
||||||
if (StringUtils.hasText(departureRoute.getItem().getActualTime())) {
|
return departureRoute.getItem().isFinish();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user