Methapolis  0.27
 All Classes Namespaces Files Functions Variables Enumerator
CityRect.java
Go to the documentation of this file.
1 // This file is part of MicropolisJ.
2 // Copyright (C) 2013 Jason Long
3 // Portions Copyright (C) 1989-2007 Electronic Arts Inc.
4 //
5 // MicropolisJ is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU GPLv3, with additional terms.
7 // See the README file, included in this distribution, for details.
8 
9 package micropolisj.engine;
10 
16 public class CityRect
17 {
19  public int x;
20 
22  public int y;
23 
25  public int width;
26 
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 }