Back to project page blocks-game.
The source code is released under:
Apache License
If you think the Android project blocks-game listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package cz.kotu.grids; // w w w.j ava 2s. c o m /** * @author Kotuc * Immutable */ public class Pos { public final int x; public final int y; public Pos(int x, int y) { this.x = x; this.y = y; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Pos other = (Pos) obj; if (this.x != other.x) { return false; } if (this.y != other.y) { return false; } return true; } @Override public int hashCode() { int hash = 3; hash = 59 * hash + this.x; hash = 59 * hash + this.y; return hash; } @Override public String toString() { return "Pos(" + x + "," + y + ")"; } public Pos inDir(Dir dir) { return new Pos(this.x + dir.dx(), this.y + dir.dy()); } }