public class ResourceConstraint extends ConstraintWithContext<Rectangle,Location,ResourceConstraint.Context>
| Modifier and Type | Class and Description |
|---|---|
class |
ResourceConstraint.Context
Assignment context
|
iConstraintListeners, iIdsMaxSize| Constructor and Description |
|---|
ResourceConstraint(int width,
int height)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
check(Assignment<Rectangle,Location> assignment) |
void |
computeConflicts(Assignment<Rectangle,Location> assignment,
Location placement,
Set<Location> conflicts)
Compute conflicts with the given placement of the rectangle.
|
ResourceConstraint.Context |
createAssignmentContext(Assignment<Rectangle,Location> assignment)
Create a new assignment context for the given assignment.
|
boolean |
inConflict(Assignment<Rectangle,Location> assignment,
Location placement)
Returns true if there is a rectangle which overlaps with the given
assignment.
|
boolean |
isConsistent(Location p1,
Location p2)
Returns true if the given rectangles (assignments) do not overlap.
|
String |
toString()
String representation of the constraint (for debugging and printing
purposes).
|
assigned, getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, setModel, unassignedaddConstraintListener, addVariable, assignedVariables, compareTo, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, getName, hashCode, isHard, removeConstraintListener, removeVariable, variablespublic ResourceConstraint(int width, int height)
width - area widthheight - area heightpublic void computeConflicts(Assignment<Rectangle,Location> assignment, Location placement, Set<Location> conflicts)
computeConflicts in class Constraint<Rectangle,Location>assignment - current assignmentplacement - value to be assigned to its variableconflicts - resultant set of conflicting valuespublic boolean inConflict(Assignment<Rectangle,Location> assignment, Location placement)
inConflict in class Constraint<Rectangle,Location>assignment - current assignmentplacement - given valuepublic boolean isConsistent(Location p1, Location p2)
isConsistent in class Constraint<Rectangle,Location>p1 - a valuep2 - a valuepublic void check(Assignment<Rectangle,Location> assignment)
public String toString()
public ResourceConstraint.Context createAssignmentContext(Assignment<Rectangle,Location> assignment)
HasAssignmentContextassignment - an assignment for which there needs to be an assignment context