@@ -0,0 +1,2043 @@
+/*%0A * This file is part of COMPASS. It is subject to the license terms in%0A * the LICENSE file found in the top-level directory of this distribution.%0A * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)%0A * You may not use this file except in compliance with the License.%0A */%0Apackage de.dfki.asr.compass.test.matcher;%0A%0Aimport de.dfki.asr.compass.math.Orientation;%0Aimport org.hamcrest.Description;%0Aimport org.hamcrest.TypeSafeMatcher;%0A%0Apublic class EulerAngleSimilarity extends TypeSafeMatcher%3COrientation%3E %7B%0A%09private final float targetYaw;%0A%09private final float targetPitch;%0A%09private final float targetRoll;%0A%09private final float epsilon;%0A%0A%09@SuppressWarnings(%22PMD.ExcessiveParameterList%22)%0A%09public EulerAngleSimilarity(final float yaw, final float pitch, final float roll, final float epsilon) %7B%0A%09%09this.targetYaw = yaw;%0A%09%09this.targetPitch = pitch;%0A%09%09this.targetRoll = roll;%0A%09%09this.epsilon = epsilon;%0A%09%7D%0A%0A%09@Override%0A%09protected boolean matchesSafely(final Orientation t) %7B%0A%09%09return Math.abs(t.getLocalYaw() - targetYaw) %3C epsilon &&%0A%09%09       Math.abs(t.getLocalPitch() - targetPitch) %3C epsilon &&%0A%09%09       Math.abs(t.getLocalRoll() - targetRoll) %3C epsilon;%0A%09%7D%0A%0A%09@Override%0A%09public void describeTo(final Description d) %7B%0A%09%09d.appendText(%22Euler angles similar to %22);%0A%09%09d.appendValueList(%22(%22,%22, %22,%22)%22,targetYaw, targetPitch, targetRoll);%0A%09%7D%0A%0A%09@Override%0A%09protected void describeMismatchSafely(final Orientation item, final Description mismatchDescription) %7B%0A%09%09mismatchDescription.appendText(%22was Euler angles %22);%0A%09%09mismatchDescription.appendValueList(%22(%22,%22, %22,%22)%22, item.getLocalYaw(), item.getLocalPitch(), item.getLocalRoll());%0A%09%7D%0A%0A%09@SuppressWarnings(%22PMD.ExcessiveParameterList%22)%0A%09public static EulerAngleSimilarity similarTo(final float yaw, final float pitch, final float roll, final float epsilon) %7B%0A%09%09return new EulerAngleSimilarity(yaw, pitch, roll, epsilon);%0A%09%7D%0A%0A%09public static EulerAngleSimilarity similarTo(final float yaw, final float pitch, final float roll) %7B%0A%09%09return new EulerAngleSimilarity(yaw, pitch, roll, 0.001f);%0A%09%7D%0A%7D%0A

Add EulerAngleSimilarity matcher