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:
parent
da0bff3ac9
commit
efc6109fa3
1 changed files with 11 additions and 1 deletions
|
|
@ -164,10 +164,20 @@ public class TourActivities {
|
||||||
for (TourActivity act : acts) {
|
for (TourActivity act : acts) {
|
||||||
if (act == activity) {
|
if (act == activity) {
|
||||||
tourActivities.remove(act);
|
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;
|
actRemoved = true;
|
||||||
} else {
|
} else {
|
||||||
if (act instanceof JobActivity && job != null) {
|
if (job != null && act instanceof JobActivity) {
|
||||||
if (((JobActivity) act).getJob().equals(job)) {
|
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;
|
jobIsAlsoAssociateToOtherActs = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue