package de.retest.recheck.ignore;

import de.retest.recheck.ui.descriptors.Element;
import de.retest.recheck.ui.descriptors.IdentifyingAttributes;
import de.retest.recheck.ui.diff.AttributeDifference;

/**
 * General interface to filter changes during Diffing
 *
 * The Filter does not define positive or negative filtering, i.e. wether only matching elements are shown or only
 * elements that do not match.
 *
 * In principal, we create a diff for everything that differs, and put that into the result file. Then it is up to the
 * UI (GUI or CLI) to hide filtered differences – this is what this interface is for. This is pretty much inline with
 * how Git works – the diff is there, it just doesn't show up when filtered.
 *
 * Can be implemented by reading a file, or by an implementation delivered by the user.
 */
public interface Filter {

	/**
	 * Returns <code>true</code> if the element <em>and all of its child elements</em>, so essentially the whole subtree
	 * this element is the root of, should be completely filtered (all attributes of all elements, whether elements are
	 * added or removed).
	 *
	 * @param element
	 *            The element in question.
	 * @return <code>true</code> if the given element should be completely filtered.
	 */
	boolean matches( final Element element );

	/**
	 * Returns <code>true</code> if the given attribute difference as specified by the triple (attribute-key,
	 * expectedValue, actualValue) should be filtered for the given element as specified by its
	 * {@link IdentifyingAttributes}.
	 *
	 * Note that for some elements all values of a given attribute key could be filtered, or an attribute key for all
	 * elements. But sometimes one wants to specify that a certain difference is meaningless, such as
	 * <code>Times Roman</code> vs. <code>Times New Roman</code> for font-family or a 5px difference for outline.
	 *
	 * If {@link #matches(Element)} returns <code>true</code>, this method must always return <code>true</code>. Can
	 * return any value only if {@link #matches(Element)} returns <code>false</code>.
	 *
	 * @param element
	 *            The element in question.
	 * @param attributeDifference
	 *            The attribute difference for the given element.
	 * @return <code>true</code> if the given attribute difference should be filtered.
	 */
	default boolean matches( final Element element, final AttributeDifference attributeDifference ) {
		return matches( element );
	}

	public static final Filter FILTER_NOTHING = new Filter() {

		@Override
		public boolean matches( final Element element ) {
			return false;
		}

		@Override
		public boolean matches( final Element element, final AttributeDifference attributeDifference ) {
			return false;
		}
	};
}

@@ -1298,16 +1298,688 @@
 ent );%0A%0A
+%09/**%0A%09 * Returns %3Ccode%3Etrue%3C/code%3E if the given attribute as specified by the attribute-key should be filtered for the%0A%09 * given element.%0A%09 *%0A%09 * If %7B@link #matches(Element)%7D returns %3Ccode%3Etrue%3C/code%3E, this method must always return %3Ccode%3Etrue%3C/code%3E. Can%0A%09 * return any value only if %7B@link #matches(Element)%7D returns %3Ccode%3Efalse%3C/code%3E.%0A%09 *%0A%09 * @param element%0A%09 *            The element in question.%0A%09 * @param attributeKey%0A%09 *            The attribute-key for the given element.%0A%09 * @return %3Ccode%3Etrue%3C/code%3E if the given attribute should be filtered.%0A%09 */%0A%09default boolean matches( final Element element, final String attributeKey ) %7B%0A%09%09return matches( element );%0A%09%7D%0A%0A
 %09/**%0A%09 *
@@ -2082,16 +2082,16 @@
 te-key,%0A
-
 %09 * expe
@@ -2565,32 +2565,39 @@
 #matches(Element
+,String
 )%7D returns %3Ccode
@@ -2655,32 +2655,32 @@
 true%3C/code%3E.
- Can
 %0A%09 *
+ Can
  return any 
@@ -2708,32 +2708,39 @@
 #matches(Element
+,String
 )%7D returns %3Ccode
@@ -3095,24 +3095,24 @@
 ference ) %7B%0A
-
 %09%09return mat
@@ -3116,32 +3116,62 @@
 matches( element
+, attributeDifference.getKey()
  );%0A%09%7D%0A%0A%09public 

Revise a default matches method. Introduce new default.