ifs.example.rpp
Class Location

java.lang.Object
  extended by ifs.model.Value
      extended by ifs.example.rpp.Location
All Implemented Interfaces:
Comparable

public class Location
extends Value

Location (value, i.e., a single placement of the rectangle). Location encodes X and Y coordinate.

Version:
1.0
Author:
Tomáš Müller

Field Summary
 
Fields inherited from class ifs.model.Value
iValue
 
Constructor Summary
Location(Rectangle rectangle, int x, int y)
          Constructor
 
Method Summary
 boolean equals(Object object)
          Compare two coordinates.
 String getName()
          Location's name.
 int getX()
          Gets x coordinate
 int getY()
          Gets y coordinate
 boolean hasIntersection(Location anotherLocation)
          Returns true if the given location intersects with this location
 String toString()
          String representation (for debugging and printing purposes).
 
Methods inherited from class ifs.model.Value
assigned, compareTo, conflicts, countAssignments, getDescription, getExtra, getId, hashCode, lastAssignmentIteration, lastUnassignmentIteration, setExtra, setVariable, toInt, unassigned, valueEquals, variable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Location

public Location(Rectangle rectangle,
                int x,
                int y)
Constructor

Parameters:
rectangle - parent variable
x - x coordinate
y - y coordinate
Method Detail

getX

public int getX()
Gets x coordinate


getY

public int getY()
Gets y coordinate


equals

public boolean equals(Object object)
Compare two coordinates. It is based on comparison of the parent rectangle and x,y coordinates

Overrides:
equals in class Value

toString

public String toString()
String representation (for debugging and printing purposes). For example, rect43=[12,10] where rect43 is the name of the parent rectangle and [12,10] is the location.

Overrides:
toString in class Value

getName

public String getName()
Location's name. E.g., [12,10] where x=12 and y=10.

Overrides:
getName in class Value

hasIntersection

public boolean hasIntersection(Location anotherLocation)
Returns true if the given location intersects with this location



Copyright © 2005 Tomáš Müller