Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ifs.example.rpp
Class ResourceConstraint

    java.lang.Object
      ifs.model.Constraint
          ifs.example.rpp.ResourceConstraint

    public class ResourceConstraint

extends Constraint

Resource constraint (rectangular area where the rectangles are to be placed). It prohibits overlapping of the placed rectangles.

Version:
  1.0
Author:
  Tomáš Müller

Constructor Summary
`ResourceConstraint(int width, int height)` Constructor.

Method Summary
`void` | `assigned(long iteration, Value value)` Notification, when a rectangle is placed.
`void` | `check()`
`void` | `computeConflicts(Value value, Set conflicts)` Compute conflicts with the given placement of the rectangle.
`boolean` | `inConflict(Value value)` Returns true if there is a rectangle which overlaps with the given assignment.
`boolean` | `isConsistent(Value value1, Value value2)` Returns true if the given rectangles (assignments) do not overlap.
`String` | `toString()` String representation of the constraint (for debugging and printing purposes).
`void` | `unassigned(long iteration, Value value)` Notification, when a rectangle is unplaced.

Methods inherited from class ifs.model.Constraint
`addConstraintListener, addVariable, assignedVariables, countAssignedVariables, countVariables, getDescription, getId, getInfo, getModel, getName, hashCode, isHard, removeConstraintListener, removeVariable, setModel, variables`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ResourceConstraint

    public ResourceConstraint(int width,
                              int height)

  Constructor.

  Parameters:
    `width` - area width
    `height` - area height

Method Detail

### computeConflicts

    public void computeConflicts(Value value,
                                 Set conflicts)

  Compute conflicts with the given placement of the rectangle. This means the rectangles which are already placed and which are overlapping with the given assignment.

  Specified by:
    `computeConflicts` in class `Constraint`
  Parameters:
    `value` - value to be assigned to its varaible
    `conflicts` - resultant set of conflicting values

### inConflict

    public boolean inConflict(Value value)

  Returns true if there is a rectangle which overlaps with the given assignment.

  Overrides:
    `inConflict` in class `Constraint`

### isConsistent

    public boolean isConsistent(Value value1,
                                Value value2)

  Returns true if the given rectangles (assignments) do not overlap.

  Overrides:
    `isConsistent` in class `Constraint`

### assigned

    public void assigned(long iteration,
                         Value value)

  Notification, when a rectangle is placed. It memorizes the rectangle's new position in 2D ([0..width][0..height]) array. It is used for faster lookup when computing conflicts.

  Overrides:
    `assigned` in class `Constraint`

### unassigned

    public void unassigned(long iteration,
                           Value value)

  Notification, when a rectangle is unplaced. It removes the rectangle from the 2D ([0..width][0..height]) array.

  Overrides:
    `unassigned` in class `Constraint`

### check

    public void check()

### toString

    public String toString()

  String representation of the constraint (for debugging and printing purposes).

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 Tomáš Müller