Interface ValueRangeDescriptor<Solution_>
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation
- All Known Implementing Classes:
AbstractFromPropertyValueRangeDescriptor,AbstractValueRangeDescriptor,CompositeValueRangeDescriptor,FromEntityPropertyValueRangeDescriptor,FromSolutionPropertyValueRangeDescriptor
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanTrue whenPlanningVariable.allowsUnassigned().booleanReturns true if the value range is defined at the solution level and can be directly extracted from the solution; otherwise, it returns false, as the value range can only be extracted or computed from the entities.<T> ValueRange<T>extractAllValues(Solution_ solution) Extracts theValueRangefrom the solution or, if the value range is defined at the entity level, extracts a compositeValueRangefrom all entities in the solution.<T> ValueRange<T>extractValuesFromEntity(Solution_ solution, Object entity) Extracts theValueRangefrom the planning entity.intA number unique within aSolutionDescriptor, increasing sequentially from zero.booleanbooleanboolean
-
Method Details
-
getOrdinal
int getOrdinal()A number unique within aSolutionDescriptor, increasing sequentially from zero. Used for indexing in arrays to avoid object hash lookups in maps.- Returns:
- zero or higher
-
getVariableDescriptor
GenuineVariableDescriptor<Solution_> getVariableDescriptor()- Returns:
- never null
-
acceptsNullInValueRange
default boolean acceptsNullInValueRange()True whenPlanningVariable.allowsUnassigned(). Always false withPlanningListVariableas list variables get unassigned through a different mechanism (e.g. ElementPositionRandomIterator). -
isGenericTypeImmutable
boolean isGenericTypeImmutable()- Returns:
- true if the value range generic type is immutable.
-
isCountable
boolean isCountable()- Returns:
- true if the
ValueRangeis countable (for example a double value range between 1.2 and 1.4 is not countable)
-
canExtractValueRangeFromSolution
boolean canExtractValueRangeFromSolution()Returns true if the value range is defined at the solution level and can be directly extracted from the solution; otherwise, it returns false, as the value range can only be extracted or computed from the entities. -
mightContainEntity
boolean mightContainEntity()- Returns:
- true if the
ValueRangemight contain a planning entity instance (not necessarily of the same entity class as this entity class of this descriptor.
-
extractAllValues
Extracts theValueRangefrom the solution or, if the value range is defined at the entity level, extracts a compositeValueRangefrom all entities in the solution.The method should not be invoked directly by selectors or other components of the solver. The
ValueRangeManager.getFromSolution(ValueRangeDescriptor, Object)andValueRangeManager.getFromEntity(ValueRangeDescriptor, Object)serve as the single source of truth for managing value ranges and should be used by outer components.Calling this method outside
ValueRangeManagermay lead to unnecessary recomputation of ranges. -
extractValuesFromEntity
Extracts theValueRangefrom the planning entity. If the value range is defined at the solution level instead, this method reads the value range from there.The method should not be invoked directly by selectors or other components of the solver. The
ValueRangeManager.getFromSolution(ValueRangeDescriptor, Object)andValueRangeManager.getFromEntity(ValueRangeDescriptor, Object)serve as the single source of truth for managing value ranges and should be used by outer components.Calling this method outside
ValueRangeManagermay lead to unnecessary recomputation of ranges.
-