public abstract class AbstractResourceConstraint extends Object implements IConstraintResource
Constructor and Description |
---|
AbstractResourceConstraint() |
Modifier and Type | Method and Description |
---|---|
boolean |
addResource(String resId,
int priority)
Checks whether the
resId is not null or empty and the priority
is not below or equal 0 , then sets the maxPriority to priority . |
boolean |
addResources(List<String> ressIds,
List<Integer> priorities)
Checks if neither the
ressIds nor the priorities are null or empty and
that they are the same size, then adds a resource addResource(String, int)
for every ressIds . |
int |
getMaxPriority()
Gets the
maxPriority . |
int |
getPriority(String resId)
Gets the priority of the resource id.
|
List<String> |
getResourceIds()
Gets an ArrayList of the resource ids.
|
Map<String,Integer> |
getResPriorityMap() |
boolean |
hasMembers() |
boolean |
isHard()
Checks the parameter or directly returns
true where this must be the case. |
void |
removeResource(String resId)
If the
Resource that is to be removed does not have the maxPriority , it is removed. |
void |
setIsHard(boolean isHard)
Sets the constraint to
hard if the respective parameter is given or returns an IllegalStateException if this is expected but not the case. |
void |
setMaxPriority(int maxPriority) |
void |
setResPriorityMap(Map<String,Integer> resPriorityMap) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
assessConstraint, getTitle, isSatisfied
public boolean isHard()
IConstraint
true
where this must be the case.isHard
in interface IConstraint
public void setIsHard(boolean isHard)
IConstraint
hard
if the respective parameter is given or returns an IllegalStateException
if this is expected but not the case.setIsHard
in interface IConstraint
isHard
- the boolean to be setpublic boolean addResource(String resId, int priority)
IConstraintResource
resId
is not null
or empty
and the priority
is not below or equal 0
, then sets the maxPriority
to priority
.addResource
in interface IConstraintResource
resId
- the string resource idpriority
- the int prioritypublic boolean addResources(List<String> ressIds, List<Integer> priorities)
IConstraintResource
ressIds
nor the priorities
are null
or empty
and
that they are the same size, then adds a resource addResource(String, int)
for every ressIds
.addResources
in interface IConstraintResource
ressIds
- the list of string idspriorities
- the list of integer prioritiespublic void removeResource(String resId)
IConstraintResource
Resource
that is to be removed does not have the maxPriority
, it is removed.
Otherwise, the priority
of the Resource
is set to 0
and the maxPriority
is set to the priority
of one of the remaining Resources
. Then the Resource
with the given resId
is removed.
removeResource
in interface IConstraintResource
resId
- the string id of the resource to be removedpublic List<String> getResourceIds()
IConstraintResource
getResourceIds
in interface IConstraintResource
public int getPriority(String resId)
IConstraintResource
getPriority
in interface IConstraintResource
resId
- string of the resource idpublic int getMaxPriority()
IConstraintResource
maxPriority
.getMaxPriority
in interface IConstraintResource
public void setMaxPriority(int maxPriority)
public boolean hasMembers()
hasMembers
in interface IConstraint
public Map<String,Integer> getResPriorityMap()
getResPriorityMap
in interface IConstraintResource
Copyright © 2017–2023 DNA Evolutions GmbH. All rights reserved.