if (!_texs[x].equals(other._texs[x])) { return false;
/** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. * * @param check * the vector to check against - null will return false. * @param buf * the buffer to compare data with * @param index * the position (in terms of vectors, not floats) of the vector in the buffer to check against * @return */ public static boolean equals(final ReadOnlyVector2 check, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector2.releaseTempInstance(temp); return equals; }
if (!_texs[x].equals(other._texs[x])) { return false;
/** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. * * @param check * the vector to check against - null will return false. * @param buf * the buffer to compare data with * @param index * the position (in terms of vectors, not floats) of the vector in the buffer to check against * @return */ public static boolean equals(final ReadOnlyVector2 check, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector2.releaseTempInstance(temp); return equals; }
@Test public void testValid() { final Vector2 vec1 = new Vector2(0, 0); final Vector2 vec2 = new Vector2(Double.POSITIVE_INFINITY, 0); final Vector2 vec3 = new Vector2(0, Double.NEGATIVE_INFINITY); final Vector2 vec4 = new Vector2(Double.NaN, 0); final Vector2 vec5 = new Vector2(0, Double.NaN); assertTrue(Vector2.isValid(vec1)); assertFalse(Vector2.isValid(vec2)); assertFalse(Vector2.isValid(vec3)); assertFalse(Vector2.isValid(vec4)); assertFalse(Vector2.isValid(vec5)); vec5.zero(); assertTrue(Vector2.isValid(vec5)); assertFalse(Vector2.isValid(null)); // couple of equals validity tests assertEquals(vec1, vec1); assertFalse(vec1.equals(null)); assertFalse(vec1.equals(new Vector3())); // throw in a couple pool accesses for coverage final Vector2 vec6 = Vector2.fetchTempInstance(); vec6.set(vec1); assertEquals(vec1, vec6); assertNotSame(vec1, vec6); Vector2.releaseTempInstance(vec6); // cover more of equals vec1.set(0, 1); assertFalse(vec1.equals(new Vector2(0, 2))); }