@@ -0,0 +1,2415 @@
+/*%0D%0A * SUDA2: An implementation of the SUDA2 algorithm for Java%0D%0A * Copyright 2017 Fabian Prasser%0D%0A * %0D%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A * you may not use this file except in compliance with the License.%0D%0A * You may obtain a copy of the License at%0D%0A * %0D%0A * http://www.apache.org/licenses/LICENSE-2.0%0D%0A * %0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License.%0D%0A */%0D%0Apackage de.linearbits.suda2;%0D%0A%0D%0Aimport java.util.Set;%0D%0A%0D%0A/**%0D%0A * Listener for MSU discoveries%0D%0A * %0D%0A * @author Fabian Prasser%0D%0A */%0D%0Apublic abstract class SUDA2ListenerMSU extends SUDA2Result %7B%0D%0A    %0D%0A    private int%5B%5D result;%0D%0A%0D%0A    /**%0D%0A     * A MSU has been discovered. Array is re-used. Columns can be found at columns%5B0%5D ... columns%5Bsize-1%5D.%0D%0A     * %0D%0A     * @param row%0D%0A     * @param columns%0D%0A     * @param size%0D%0A     */%0D%0A    public abstract void keyFound(int row, int%5B%5D columns, int size);%0D%0A%0D%0A    @Override%0D%0A    void init(int columns, int maxK, int numUniqueRecords, int numDuplicateRecords) %7B%0D%0A        this.result = new int%5Bcolumns%5D;%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    void registerKey(Set%3CSUDA2Item%3E set) %7B%0D%0A        throw new UnsupportedOperationException(%22%22);%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    void registerKey(SUDA2Item item, SUDA2ItemSet set) %7B%0D%0A        %0D%0A        // Store columns%0D%0A        for (int i = 0; i %3C set.size(); i++) %7B%0D%0A            result%5Bi%5D = set.get(i).getColumn();%0D%0A        %7D%0D%0A        result%5Bset.size()%5D = item.getColumn();%0D%0A        %0D%0A        // Compute row%0D%0A        SUDA2Item temp = item;%0D%0A        for (int i = 0; i %3C set.size(); i++) %7B%0D%0A            temp = temp.getProjection(set.get(i).getRows());%0D%0A        %7D%0A        int row = temp.getRows().min();%0D%0A        %0D%0A        // Signal%0D%0A        keyFound(row - 1, result, set.size() + 1);%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    void registerKey(SUDA2ItemSet set) %7B%0D%0A        %0D%0A        // Store row%0D%0A        int row = set.get(0).getRows().min();%0D%0A        %0D%0A        // Store columns%0D%0A        int size = set.size();%0D%0A        for (int i = 0; i %3C size; i++) %7B%0D%0A            result%5Bi%5D = set.get(i).getColumn();%0D%0A        %7D%0D%0A        %0D%0A        // Signal%0D%0A        keyFound(row - 1, result, size);%0D%0A    %7D%0D%0A%7D%0D%0A

Add listener to detect individual MSUs