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 SummaryConstructors
- 
Method SummaryModifier 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.dna.jopt.member.unit.condition.IConstraintassessConstraint, getTitle, isSatisfied
- 
Constructor Details- 
AbstractResourceConstraintpublic AbstractResourceConstraint()
 
- 
- 
Method Details- 
isHardpublic boolean isHard()Description copied from interface:IConstraintChecks the parameter or directly returnstruewhere this must be the case.- Specified by:
- isHardin interface- IConstraint
- Returns:
- the value of the checked boolean
 
- 
setIsHardpublic 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 interface- IConstraint
- Parameters:
- isHard- the boolean to be set
 
- 
addResourceDescription copied from interface:IConstraintResourceChecks whether theresIdis notnulloremptyand thepriorityis not below or equal0, then sets themaxPrioritytopriority.- Specified by:
- addResourcein interface- IConstraintResource
- Parameters:
- resId- the string resource id
- priority- the int priority
- Returns:
- true, if was added
 
- 
addResourcesDescription 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 interface- IConstraintResource
- Parameters:
- ressIds- the list of string ids
- priorities- the list of integer priorities
- Returns:
- true, if all were added
 
- 
removeResourceDescription 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 interface- IConstraintResource
- Parameters:
- resId- the string id of the resource to be removed
 
- 
getResourceIdsDescription copied from interface:IConstraintResourceGets an ArrayList of the resource ids.- Specified by:
- getResourceIdsin interface- IConstraintResource
- Returns:
- an arrayList with a set view of the keys contained in this map
 
- 
getPriorityDescription copied from interface:IConstraintResourceGets the priority of the resource id.- Specified by:
- getPriorityin interface- IConstraintResource
- Parameters:
- resId- string of the resource id
- Returns:
- the priority of the resource
 
- 
getMaxPrioritypublic int getMaxPriority()Description copied from interface:IConstraintResourceGets themaxPriority.- Specified by:
- getMaxPriorityin interface- IConstraintResource
- Returns:
- the max priority
 
- 
setMaxPrioritypublic void setMaxPriority(int maxPriority) 
- 
hasMemberspublic boolean hasMembers()- Specified by:
- hasMembersin interface- IConstraint
 
- 
getResPriorityMap- Specified by:
- getResPriorityMapin interface- IConstraintResource
 
- 
setResPriorityMap
 
-