Class AbstractZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
java.lang.Object
com.dna.jopt.member.unit.condition.workinghour.zone.AbstractZoneCodeConstraint<Z,Q>
- All Implemented Interfaces:
IConstraint,IWorkingHoursLevelConstraint,IZoneCodeConstraint<Z,,Q> Serializable
- Direct Known Subclasses:
UKPostCodeConstraint,ZoneNumberConstraint
public abstract class AbstractZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
extends Object
implements IZoneCodeConstraint<Z,Q>
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intPriority assigned to a zone when none is supplied explicitly. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddZoneCode(Z code) booleanaddZoneCode(Z code, int priority) intHighest priority across all registered zones.intgetPriority(Z code) Priority of a single zone, falling back toDEFAULT_PRIORITYwhen the zone has no explicit entry.booleanbooleanIndicates that all registered zones share one priority.booleanisHard()Checks the parameter or directly returnstruewhere this must be the case.booleanisSatisfied(com.dna.jopt.assessment.costassessor.IEntityCostAssessor ca, INode node, ILogicEntityRoute route) Filters out hard constraint mismatches by checking whether aNodedemands aQualificationas ahard constraintbut theResourcedoes not provide this one.voidvoidsetIsHard(boolean isHard) Sets the constraint tohardif the respective parameter is given or returns anIllegalStateExceptionif this is expected but not the case.voidsetZonePriorityMap(Map<Z, Integer> priorityMap) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.dna.jopt.member.unit.condition.IConstraint
assessConstraint, getTitleMethods inherited from interface com.dna.jopt.member.unit.condition.workinghour.zone.IZoneCodeConstraint
getNodeZoneQualification, matchCodesAndPenalize, matchZoneCodes
-
Field Details
-
DEFAULT_PRIORITY
public static final int DEFAULT_PRIORITYPriority assigned to a zone when none is supplied explicitly.- See Also:
-
-
Constructor Details
-
AbstractZoneCodeConstraint
public AbstractZoneCodeConstraint()
-
-
Method Details
-
hasMembers
public boolean hasMembers()- Specified by:
hasMembersin interfaceIConstraint
-
setIsHard
public void setIsHard(boolean isHard) Description copied from interface:IConstraintSets the constraint tohardif the respective parameter is given or returns anIllegalStateExceptionif this is expected but not the case.- Specified by:
setIsHardin interfaceIConstraint- Parameters:
isHard- the boolean to be set
-
isHard
public boolean isHard()Description copied from interface:IConstraintChecks the parameter or directly returnstruewhere this must be the case.- Specified by:
isHardin interfaceIConstraint- Returns:
- the value of the checked boolean
-
getZoneCodes
- Specified by:
getZoneCodesin interfaceIZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
-
addZoneCode
- Specified by:
addZoneCodein interfaceIZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
-
addZoneCode
- Specified by:
addZoneCodein interfaceIZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
-
setCodes
- Specified by:
setCodesin interfaceIZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
-
isSatisfied
public boolean isSatisfied(com.dna.jopt.assessment.costassessor.IEntityCostAssessor ca, INode node, ILogicEntityRoute route) Description copied from interface:IConstraintFilters out hard constraint mismatches by checking whether aNodedemands aQualificationas ahard constraintbut theResourcedoes not provide this one. The idea is to have onlysoft constraintsproblems in the optimisation which can get solved by adding cost.- Specified by:
isSatisfiedin interfaceIConstraint- Parameters:
ca- the iEntityCostAssessornode- the iNoderoute- the iLogicEntityRoute- Returns:
- the boolean whether the route is satisfied.
Truemeans no problems detected
-
getZonePriorityMap
- Specified by:
getZonePriorityMapin interfaceIZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
-
setZonePriorityMap
-
getPriority
Priority of a single zone, falling back toDEFAULT_PRIORITYwhen the zone has no explicit entry.- Parameters:
code- the zone code- Returns:
- the priority of the zone
-
getMaxPriority
public int getMaxPriority()Highest priority across all registered zones. The master zone is the zone holding this value.- Returns:
- the highest registered priority
-
isAllSamePriority
public boolean isAllSamePriority()Indicates that all registered zones share one priority. When true, every matched zone is equally preferred and no per zone lookup is required.- Returns:
- true if all zones share the same priority
-