Methapolis  0.27
 All Classes Namespaces Files Functions Variables Enumerator
CityDimension.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 
14 public class CityDimension
15 {
16  public int width;
17  public int height;
18 
19  public CityDimension(int width, int height)
20  {
21  this.width = width;
22  this.height = height;
23  }
24 
25  @Override
26  public int hashCode()
27  {
28  return width*33+height;
29  }
30 
31  @Override
32  public boolean equals(Object obj)
33  {
34  if (obj instanceof CityDimension) {
35  CityDimension rhs = (CityDimension) obj;
36  return this.width == rhs.width && this.height == rhs.height;
37  }
38  else {
39  return false;
40  }
41  }
42 
43  @Override
44  public String toString()
45  {
46  return width+"x"+height;
47  }
48 }