00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package com.realtime.crossfire.jxclient.map;
00023
00024 import org.jetbrains.annotations.NotNull;
00025 import org.jetbrains.annotations.Nullable;
00026
00031 public class Location {
00032
00036 private final int x;
00037
00041 private final int y;
00042
00046 private final int layer;
00047
00054 public Location(final int x, final int y, final int layer) {
00055 this.x = x;
00056 this.y = y;
00057 this.layer = layer;
00058 }
00059
00064 public int getX() {
00065 return x;
00066 }
00067
00072 public int getY() {
00073 return y;
00074 }
00075
00080 public int getLayer() {
00081 return layer;
00082 }
00083
00087 @Override
00088 public boolean equals(@Nullable final Object obj) {
00089 if (obj == null) {
00090 return false;
00091 }
00092 if (obj.getClass() != Location.class) {
00093 return false;
00094 }
00095 final Location loc = (Location)obj;
00096 return loc.x == x && loc.y == y && loc.layer == layer;
00097 }
00098
00102 @Override
00103 public int hashCode() {
00104 return x^y*0x1000^layer*0x1000000;
00105 }
00106
00110 @NotNull
00111 @Override
00112 public String toString() {
00113 return x+"/"+y+"/"+layer;
00114 }
00115
00116 }