Specifies a rectangular area in the city's coordinate space. This class is functionally equivalent to Java AWT's Rectangle class, but is portable to Java editions that do not contain AWT.
| 14 | * class, but is portable to Java editions that do not contain AWT. |
| 15 | */ |
| 16 | public class CityRect |
| 17 | { |
| 18 | /** The X coordinate of the upper-left corner of the rectangle. */ |
| 19 | public int x; |
| 20 | |
| 21 | /** The Y coordinate of the upper-left corner of the rectangle. */ |
| 22 | public int y; |
| 23 | |
| 24 | /** The width of the rectangle. */ |
| 25 | public int width; |
| 26 | |
| 27 | /** The height of the rectangle. */ |
| 28 | public int height; |
| 29 | |
| 30 | public CityRect() |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | public CityRect(int x, int y, int width, int height) |
| 35 | { |
| 36 | this.x = x; |
| 37 | this.y = y; |
| 38 | this.width = width; |
| 39 | this.height = height; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public boolean equals(Object obj) |
| 44 | { |
| 45 | if (obj instanceof CityRect) { |
| 46 | CityRect rhs = (CityRect)obj; |
| 47 | return this.x == rhs.x && |
| 48 | this.y == rhs.y && |
| 49 | this.width == rhs.width && |
| 50 | this.height == rhs.height; |
| 51 | } |
| 52 | else { |
| 53 | return false; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public String toString() |
| 59 | { |
| 60 | return "["+x+","+y+","+width+"x"+height+"]"; |
| 61 | } |
| 62 | } |
nothing calls this directly
no outgoing calls
no test coverage detected