Class AbstractResourceConstraint
java.lang.Object
com.dna.jopt.member.unit.condition.resource.AbstractResourceConstraint
- All Implemented Interfaces:
IConstraint,IConstraintResource,Serializable
- Direct Known Subclasses:
BindingResourceConstraint,ExcludingResourceConstraint
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddResource(String resId, int priority) Checks whether theresIdis notnulloremptyand thepriorityis not below or equal0, then sets themaxPrioritytopriority.booleanaddResources(List<String> ressIds, List<Integer> priorities) Checks if neither theressIdsnor theprioritiesarenulloremptyand that they are the same size, then adds a resourceaddResource(String, int)for everyressIds.intGets themaxPriority.intgetPriority(String resId) Gets the priority of the resource id.Gets an ArrayList of the resource ids.booleanbooleanisHard()Checks the parameter or directly returnstruewhere this must be the case.voidremoveResource(String resId) If theResourcethat is to be removed does not have themaxPriority, it is removed.voidsetIsHard(boolean isHard) Sets the constraint tohardif the respective parameter is given or returns anIllegalStateExceptionif this is expected but not the case.voidsetMaxPriority(int maxPriority) voidsetResPriorityMap(Map<String, Integer> resPriorityMap) 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, getTitle, isSatisfied
-
Constructor Details
-
AbstractResourceConstraint
public AbstractResourceConstraint()
-
-
Method Details
-
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
-
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
-
addResource
Description copied from interface:IConstraintResourceChecks whether theresIdis notnulloremptyand thepriorityis not below or equal0, then sets themaxPrioritytopriority.- Specified by:
addResourcein interfaceIConstraintResource- Parameters:
resId- the string resource idpriority- the int priority- Returns:
- true, if was added
-
addResources
Description copied from interface:IConstraintResourceChecks if neither theressIdsnor theprioritiesarenulloremptyand that they are the same size, then adds a resourceaddResource(String, int)for everyressIds.- Specified by:
addResourcesin interfaceIConstraintResource- Parameters:
ressIds- the list of string idspriorities- the list of integer priorities- Returns:
- true, if all were added
-
removeResource
Description copied from interface:IConstraintResourceIf theResourcethat is to be removed does not have themaxPriority, it is removed.Otherwise, the
priorityof theResourceis set to0and themaxPriorityis set to thepriorityof one of the remainingResources. Then theResourcewith the givenresIdis removed.- Specified by:
removeResourcein interfaceIConstraintResource- Parameters:
resId- the string id of the resource to be removed
-
getResourceIds
Description copied from interface:IConstraintResourceGets an ArrayList of the resource ids.- Specified by:
getResourceIdsin interfaceIConstraintResource- Returns:
- an arrayList with a set view of the keys contained in this map
-
getPriority
Description copied from interface:IConstraintResourceGets the priority of the resource id.- Specified by:
getPriorityin interfaceIConstraintResource- Parameters:
resId- string of the resource id- Returns:
- the priority of the resource
-
getMaxPriority
public int getMaxPriority()Description copied from interface:IConstraintResourceGets themaxPriority.- Specified by:
getMaxPriorityin interfaceIConstraintResource- Returns:
- the max priority
-
setMaxPriority
public void setMaxPriority(int maxPriority) -
hasMembers
public boolean hasMembers()- Specified by:
hasMembersin interfaceIConstraint
-
getResPriorityMap
- Specified by:
getResPriorityMapin interfaceIConstraintResource
-
setResPriorityMap
-