ifs.example.rpp
Class Rectangle

java.lang.Object
  extended by ifs.model.Variable
      extended by ifs.example.rpp.Rectangle
All Implemented Interfaces:
Comparable

public class Rectangle
extends Variable

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:
1.0
Author:
Tomáš Müller

Field Summary
 
Fields inherited from class ifs.model.Variable
iValue
 
Constructor Summary
Rectangle(String name, int width, int height, int minX, int maxX, int minY, int maxY, Location initialLocation)
          Constructor.
 
Method Summary
 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 ifs.model.Variable
addContstraint, addVariableListener, assign, compareTo, constraints, constraintVariables, countAssignments, getAssignment, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getId, getInitialAssignment, getModel, hardConstraints, hasAssignment, hashCode, hasInitialAssignment, lastAssignmentIteration, lastUnassignmentIteration, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setBestAssignment, setExtra, setInitialAssignment, setModel, setValues, softConstraints, unassign, values
 
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).


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.


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


getHeight

public int getHeight()
Returns height of the rectangle


getName

public String getName()
Returns name of the rectangle

Overrides:
getName in class Variable

setBounds

public void setBounds(int minX,
                      int maxX,
                      int minY,
                      int maxY)
Set the bounds (minimal and maximal values of X and Y coordinates).


toString

public String toString()
String representation (for printing and debugging purposes)

Overrides:
toString in class Variable

equals

public boolean equals(Object o)
Compares two rectangles (based on rectangle names)

Overrides:
equals in class Variable


Copyright © 2005 Tomáš Müller