mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Merge branch 'master' of git@bitbucket.org:Major-/apollo.git.
This commit is contained in:
@@ -161,7 +161,8 @@ public final class CollisionMatrix {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MoreObjects.toStringHelper(this).add("width", width).add("length", length).add("matrix", Arrays.toString(matrix)).toString();
|
return MoreObjects.toStringHelper(this).add("width", width).add("length", length).add("matrix", Arrays.toString(matrix))
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,8 +210,9 @@ public final class CollisionMatrix {
|
|||||||
* @throws ArrayIndexOutOfBoundsException If the specified coordinate pair does not fit in this matrix.
|
* @throws ArrayIndexOutOfBoundsException If the specified coordinate pair does not fit in this matrix.
|
||||||
*/
|
*/
|
||||||
private int indexOf(int x, int y) {
|
private int indexOf(int x, int y) {
|
||||||
|
Preconditions.checkElementIndex(x, width, "X coordinate must be [0, " + width + "), received " + x + ".");
|
||||||
|
Preconditions.checkElementIndex(y, length, "Y coordinate must be [0, " + length + "), received " + y + ".");
|
||||||
int index = y * width + x;
|
int index = y * width + x;
|
||||||
Preconditions.checkElementIndex(index, matrix.length, "Index out of bounds.");
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user