1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

speed up TourActivities.removeActivity()

This commit is contained in:
Michal Maciejewski 2019-05-09 10:42:09 +02:00
parent da0bff3ac9
commit efc6109fa3
No known key found for this signature in database
GPG key ID: 015947E60A2AD77B

View file

@ -164,10 +164,20 @@ public class TourActivities {
for (TourActivity act : acts) {
if (act == activity) {
tourActivities.remove(act);
if (job == null || jobIsAlsoAssociateToOtherActs) {
// this is not a job activity OR other activities also refer to job --> do not remove job
// thus no need to iterate any further
return true;
}
actRemoved = true;
} else {
if (act instanceof JobActivity && job != null) {
if (job != null && act instanceof JobActivity) {
if (((JobActivity) act).getJob().equals(job)) {
if (actRemoved) {
// other activities also refer to job --> do not remove job
// thus no need to iterate any further
return true;
}
jobIsAlsoAssociateToOtherActs = true;
}
}