1 package net.sf.josceleton.core.impl.entity;
2
3 import net.sf.josceleton.core.api.entity.Coordinate;
4
5 import com.google.inject.Inject;
6 import com.google.inject.assistedinject.Assisted;
7
8 class CoordinateImpl implements Coordinate {
9
10 private final float x;
11
12 private final float y;
13
14 private final float z;
15
16
17 @Inject CoordinateImpl(
18 @Assisted("x") final float x,
19 @Assisted("y") final float y,
20 @Assisted("z") final float z) {
21
22 this.x = x;
23
24
25 this.y = y;
26
27 this.z = z;
28 }
29
30
31 @Override public final float x() { return this.x; }
32
33
34 @Override public final float y() { return this.y; }
35
36
37 @Override public final float z() { return this.z; }
38
39
40 @Override public final boolean equals(final Object other) {
41 if(this == other) { return true; }
42 if((other instanceof Coordinate) == false) {
43 return false;
44 }
45 final Coordinate that = (Coordinate) other;
46 return this.x() == that.x() && this.y() == that.y() && this.z() == that.z();
47 }
48
49 @Override public final int hashCode() {
50 return Float.valueOf(this.x).hashCode();
51 }
52
53 @Override public final String toString() {
54 return "CoordinateImpl[x=" + this.x + ", y=" + this.y + ", z=" + this.z + "]";
55 }
56 }