/*
 * Copyright (c) 2012 Mateusz Parzonka, Eric Bodden
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Mateusz Parzonka - initial API and implementation
 */
package prm4j.indexing.realtime;

import java.util.ArrayList;
import java.util.List;

import prm4j.api.MatchHandler1;
import prm4j.api.Parameter;

public class AwareMatchHandler<P1> {

    public static <P1> AwareMatchHandler1<P1> create(Parameter<P1> param1) {
	return new AwareMatchHandler1<P1>(param1);
    }

    public static class AwareMatchHandler1<P1> extends MatchHandler1<P1> {

	private final List<P1> handledMatches;

	public AwareMatchHandler1(Parameter<P1> param1) {
	    super(param1);
	    handledMatches = new ArrayList<P1>();
	}

	@Override
	public void handleMatch(P1 obj1) {
	    handledMatches.add(obj1);
	}

	/**
	 * Returns a list of handled matches for the given object.
	 *
	 * @return
	 */
	public List<P1> getHandledMatches() {
	    return handledMatches;
	}

    }
}
@@ -474,25 +474,101 @@
 m4j.
-api.MatchHandler1
+Util;%0Aimport prm4j.Util.Tuple;%0Aimport prm4j.api.MatchHandler1;%0Aimport prm4j.api.MatchHandler2
 ;%0Aim
@@ -760,16 +760,186 @@
 %0A    %7D%0A%0A
+    public static %3CP1, P2%3E AwareMatchHandler2%3CP1, P2%3E create(Parameter%3CP1%3E param1, Parameter%3CP2%3E param2) %7B%0A%09return new AwareMatchHandler2%3CP1, P2%3E(param1, param2);%0A    %7D%0A%0A
     publ
@@ -1278,44 +1278,637 @@
  of 
-handled matches for the given object
+object which participated in a detected match.%0A%09 *%0A%09 * @return%0A%09 */%0A%09public List%3CP1%3E getHandledMatches() %7B%0A%09    return handledMatches;%0A%09%7D%0A%0A    %7D%0A%0A    public static class AwareMatchHandler2%3CP1, P2%3E extends MatchHandler2%3CP1, P2%3E %7B%0A%0A%09private final List%3CTuple%3CP1, P2%3E%3E handledMatches;%0A%0A%09public AwareMatchHandler2(Parameter%3CP1%3E param1, Parameter%3CP2%3E param2) %7B%0A%09    super(param1, param2);%0A%09    handledMatches = new ArrayList%3CTuple%3CP1, P2%3E%3E();%0A%09%7D%0A%0A%09@Override%0A%09public void handleMatch(P1 obj1, P2 obj2) %7B%0A%09    handledMatches.add(Util.tuple(obj1, obj2));%0A%09%7D%0A%0A%09/**%0A%09 * Returns a list of object tuples which participated in a detected match
 .%0A%09 
@@ -1931,34 +1931,45 @@
 */%0A%09public List%3C
-P1
+Tuple%3CP1, P2%3E
 %3E getHandledMatc

Add creation of binary AwareMatchHandlers