org.cpsolver.ifs.example.rpp

## Class Rectangle

- java.lang.Object
- - org.cpsolver.ifs.model.Variable<Rectangle,Location>
  - - org.cpsolver.ifs.example.rpp.Rectangle

- All Implemented Interfaces:
    Comparable<Rectangle>

      public class Rectangle
      extends Variable<Rectangle,Location>

  Rectangle (variable). It encodes the name, width and height of the rectangle, minimal and maximal position of the rectangle. It also contains an information about prohibited X and Y coordinate (for MPP).
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2006 - 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.

- - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.model.Variable

      `iId, iIndex, iValue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Rectangle(String name, int width, int height, int minX, int maxX, int minY, int maxY, Location initialLocation)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` Compares two rectangles (based on rectangle names)
    `int` | `getHeight()` Returns height of the rectangle
    `int` | `getMaxX()`
    `int` | `getMaxY()`
    `int` | `getMinX()`
    `int` | `getMinY()`
    `String` | `getName()` Returns name of the rectangle
    `int` | `getProhibitedX()`
    `int` | `getProhibitedY()`
    `int` | `getWidth()` Returns width of the rectangle
    `boolean` | `isProhibited(int x, int y)` Returns true if the given location is prohibited.
    `void` | `setBounds(int minX, int maxX, int minY, int maxY)` Set the bounds (minimal and maximal values of X and Y coordinates).
    `void` | `setProhibited()` Prohibits given initial location (for MPP).
    `void` | `setProhibited(int x, int y)` Prohibits given X and Y coordinates (for MPP).
    `String` | `toString()` String representation (for printing and debugging purposes)

    - ### Methods inherited from class org.cpsolver.ifs.model.Variable

      `addContstraint, addVariableListener, assign, compareTo, constraints, constraintVariables, getAssignment, getAssignment, getAssignments, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getId, getIndex, getInitialAssignment, getLastIteration, getModel, getVariableListeners, hardConstraints, hasAssignment, hasAssignment, hashCode, hasInitialAssignment, hasValues, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setAssignment, setBestAssignment, setExtra, setIndex, setInitialAssignment, setLastIteration, setModel, setValues, softConstraints, unassign, values, values, variableAssigned, variableUnassigned`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Rectangle

          public Rectangle(String name,
                           int width,
                           int height,
                           int minX,
                           int maxX,
                           int minY,
                           int maxY,
                           Location initialLocation)

      Constructor.
      Parameters:
        `name` - variable's name
        `width` - width of the rectangle
        `height` - height of the rectangle
        `minX` - minimal X-coordinate
        `maxX` - maximal X-coordinate
        `minY` - minimal Y-coordinate
        `maxY` - maximal Y-coordinate
        `initialLocation` - initial location (null if none)

  - ### Method Detail

    - #### setProhibited

          public void setProhibited(int x,
                                    int y)

      Prohibits given X and Y coordinates (for MPP).
      Parameters:
        `x` - X coordinate
        `y` - Y coordinate

    - #### setProhibited

          public void setProhibited()

      Prohibits given initial location (for MPP).

    - #### isProhibited

          public boolean isProhibited(int x,
                                      int y)

      Returns true if the given location is prohibited. This means that either X or Y equals to the prohibited X or Y coordinate respectively.
      Parameters:
        `x` - X coordinate
        `y` - Y coordinate
      Returns:
        true if the given location is prohibited

    - #### getProhibitedX

          public int getProhibitedX()

    - #### getProhibitedY

          public int getProhibitedY()

    - #### getMinX

          public int getMinX()

    - #### getMaxX

          public int getMaxX()

    - #### getMinY

          public int getMinY()

    - #### getMaxY

          public int getMaxY()

    - #### getWidth

          public int getWidth()

      Returns width of the rectangle
      Returns:
        width of the rectangle

    - #### getHeight

          public int getHeight()

      Returns height of the rectangle
      Returns:
        height of the rectangle

    - #### getName

          public String getName()

      Returns name of the rectangle
      Overrides:
        `getName` in class `Variable<Rectangle,Location>`
      Returns:
        variable name

    - #### setBounds

          public void setBounds(int minX,
                                int maxX,
                                int minY,
                                int maxY)

      Set the bounds (minimal and maximal values of X and Y coordinates).
      Parameters:
        `minX` - X minimum
        `maxX` - X maximum
        `minY` - Y minimum
        `maxY` - Y maximum

    - #### toString

          public String toString()

      String representation (for printing and debugging purposes)
      Overrides:
        `toString` in class `Variable<Rectangle,Location>`

    - #### equals

          public boolean equals(Object o)

      Compares two rectangles (based on rectangle names)
      Overrides:
        `equals` in class `Variable<Rectangle,Location>`