-
Story
-
Resolution: Done
-
Major
-
None
-
None
-
2022 Week 32-34 (from Aug 8), 2022 Week 35-37 (from Aug 29), 2022 Week 38-40 (from Sept 19)
-
8
-
undefined
-
NEW
-
NEW
With inverse and index shadow variables, users can write:
@InverseRelationShadowVariable(sourceVariableName = "tasks")
private Employee employee;
@IndexShadowVariable(sourceVariableName = "tasks")
private Integer index;
public Task getNextTask() {
if (index == employee.getTasks().size() - 1) {
return null;
}
return employee.getTasks().get(index + 1);
}
public Task getPreviousTask() {
if (index == 0) {
return null;
}
return employee.getTasks().get(index - 1);
}
We can save user from writing boiler plate code with this:
@PreviousElementShadowVariable(sourceVariableName = "tasks")
private Task previousTask;
@NextElementShadowVariable(sourceVariableName = "tasks")
private Task nextTask;
public Task getPreviousTask() {
return previousTask;
}
public Task getNextTask() {
return nextTask;
}
Questions:
- Do users really need it? Task assigning doesn't. VRP uses previousCustomer to calculate route distance.
- What if VRP performs better with a custom distance updating listener and it turns out it doesn't need previous/next either?