Annotation Interface ShadowSources
Specifies the paths to variables that a method referenced by
ShadowVariable.supplierName()
uses to compute the value of a ShadowVariable.-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionString[]The paths to variables the method uses to compute the value of asupplier variable.
-
Element Details
-
value
String[] valueThe paths to variables the method uses to compute the value of asupplier variable.Each path is a
Stringthat is one of the following three forms:- "variableName", for referring any variable on the same planning entity.
-
A list of names seperated by ".", such as "variableOrFact.fact.entity.supplierVariable",
for referencing a supplier variable accessible from the planning entity.
The first property may be a fact or any non-supplier variable; the remaining properties before the end
must be facts, and the final property must be a supplier variable.
For the path "a.b", it refers to the supplier variable "b"
on the property/variable "a" of the planning entity.
In general, if you access a variable in your method using a chain like
a.b.c, that chain should be included as a source. -
A list of names seperated by ".", followed by a name suffix by "[].",
followed by either of the forms above.
For example, "group[].previous".
In this case, "group" is a
Collectionon the planning entity, and the annotated method uses the "previous" variable of each element in the collection. The collection must not change during solving and may be null.
The value@InverseRelationShadowVariable Entity entity; @PreviousElementShadowVariable Value previous; @ShadowVariable(supplierName="startTimeSupplier") LocalDateTime startTime; @ShadowVariable(supplierName="endTimeSupplier") LocalDateTime endTime; Collection<Value> dependencies; @ShadowSources("previous.endTime", "entity", "dependencies[].endTime") public LocalDateTime startTimeSupplier() { LocalDateTime readyTime = null; if (previous != null) { readyTime = previous.endTime; } else if (entity != null) { readyTime = entity.startTime; } else { return null; } if (dependencies != null) { for (var dependency : dependencies) { if (dependency.endTime == null) { return null; } readyTime = (readyTime.isBefore(dependency.endTime)? dependency.endTime: readyTime; } } return readyTime; }{ "previous.endTime", "entity", "dependencies[].endTime") }is used forShadowSourcessince it accesses the end time supplier variable of its previous element variable ("previous.endTime"), a fact on its inverse relation variable ("entity"), and the end time supplier variable on each element in its dependencies ("dependencies[].endTime").- Returns:
- A non-empty list of variables the supplier method accesses.
-