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 Details

    • DEFAULT_PRIORITY

      public static final int DEFAULT_PRIORITY
      Priority assigned to a zone when none is supplied explicitly.
      See Also:
  • Constructor Details

    • AbstractZoneCodeConstraint

      public AbstractZoneCodeConstraint()
  • Method Details

    • hasMembers

      public boolean hasMembers()
      Specified by:
      hasMembers in interface IConstraint
    • setIsHard

      public void setIsHard(boolean isHard)
      Description copied from interface: IConstraint
      Sets the constraint to hard if the respective parameter is given or returns an IllegalStateException if this is expected but not the case.
      Specified by:
      setIsHard in interface IConstraint
      Parameters:
      isHard - the boolean to be set
    • isHard

      public boolean isHard()
      Description copied from interface: IConstraint
      Checks the parameter or directly returns true where this must be the case.
      Specified by:
      isHard in interface IConstraint
      Returns:
      the value of the checked boolean
    • getZoneCodes

      public List<Z> getZoneCodes()
      Specified by:
      getZoneCodes in interface IZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
    • addZoneCode

      public void addZoneCode(Z code)
      Specified by:
      addZoneCode in interface IZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
    • addZoneCode

      public boolean addZoneCode(Z code, int priority)
      Specified by:
      addZoneCode in interface IZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
    • setCodes

      public void setCodes(List<Z> codes)
      Specified by:
      setCodes in interface IZoneCodeConstraint<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: IConstraint
      Filters out hard constraint mismatches by checking whether a Node demands a Qualification as a hard constraint but the Resource does not provide this one. The idea is to have only soft constraints problems in the optimisation which can get solved by adding cost.
      Specified by:
      isSatisfied in interface IConstraint
      Parameters:
      ca - the iEntityCostAssessor
      node - the iNode
      route - the iLogicEntityRoute
      Returns:
      the boolean whether the route is satisfied. True means no problems detected
    • getZonePriorityMap

      public Map<Z,Integer> getZonePriorityMap()
      Specified by:
      getZonePriorityMap in interface IZoneCodeConstraint<Z extends IZoneCode,Q extends IZoneCodeQualification<Z>>
    • setZonePriorityMap

      public void setZonePriorityMap(Map<Z,Integer> priorityMap)
    • getPriority

      public int getPriority(Z code)
      Priority of a single zone, falling back to DEFAULT_PRIORITY when 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