// Path: src/main/java/com/antelink/sourcesquare/event/base/EventBus.java
// public class EventBus {
// 
//     private static final Log logger = LogFactory.getLog(EventBus.class);
// 
//     HashMap<ClientEventType<?>, List<? extends ClientEventHandler>> eventMap = new HashMap<ClientEventType<?>, List<? extends ClientEventHandler>>();
// 
//     @SuppressWarnings("unchecked")
//     public <T extends ClientEventHandler> void addHandler(ClientEventType<T> eventType, T handler) {
//         if (!this.eventMap.containsKey(eventType)) {
//             this.eventMap.put(eventType, new ArrayList<T>());
//         }
//         ((ArrayList<T>) this.eventMap.get(eventType)).add(0, handler);
//     }
// 
//     @SuppressWarnings("unchecked")
//     public <T extends ClientEventHandler> void fireEvent(final ClientEvent<T> event) {
//         if (!this.eventMap.containsKey(event.getHandlerType())) {
//             return;
//         }
//         for (final ClientEventHandler handler : this.eventMap.get(event.getHandlerType())) {
//             try {
//                 Runnable runner = new Runnable() {
// 
//                     @Override
//                     public void run() { 
//                         event.dispatch((T) handler);
// 
//                     }
//                 };
// 
//                 Thread thread = new Thread(runner);
//                 thread.start();
// 
//                 logger.trace("event dispatched to the handler " + handler.getId());
//             } catch (Exception e) {
//                 logger.error("An event could not be dispatched to the handler " + handler.getId(), e);
//             }
//         }
//     }
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/events/FilesIdentifiedEvent.java
// public class FilesIdentifiedEvent implements ClientEvent<FilesIdentifiedEventHandler> {
// 
//     public static final ClientEventType<FilesIdentifiedEventHandler> TYPE = new ClientEventType<FilesIdentifiedEventHandler>();
// 
//     private final TreeSet<File> fileSet;
// 
//     public FilesIdentifiedEvent(TreeSet<File> fileSet) {
//         this.fileSet = fileSet;
//     }
// 
//     @Override
//     public ClientEventType<FilesIdentifiedEventHandler> getHandlerType() {
//         return TYPE;
//     }
// 
//     @Override
//     public void dispatch(FilesIdentifiedEventHandler handler) {
//         handler.handle(this.fileSet);
// 
//     }
// 
//     public TreeSet<File> getFileSet() {
//         return this.fileSet;
//     }
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/events/HiddenFileFoundEvent.java
// public class HiddenFileFoundEvent implements ClientEvent<HiddenFileFoundEventHandler> {
// 
//     public static final ClientEventType<HiddenFileFoundEventHandler> TYPE = new ClientEventType<HiddenFileFoundEventHandler>();
//     private File file;
// 
//     public HiddenFileFoundEvent(File file) {
//         this.file = file;
//     }
// 
//     @Override
//     public ClientEventType<HiddenFileFoundEventHandler> getHandlerType() {
//         return TYPE;
//     }
// 
//     @Override
//     public void dispatch(HiddenFileFoundEventHandler handler) {
//         handler.handle(this.file);
//     }
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/events/OSFilesFoundEvent.java
// public class OSFilesFoundEvent implements ClientEvent<OSFilesFoundEventHandler> {
// 
//     public static final ClientEventType<OSFilesFoundEventHandler> TYPE = new ClientEventType<OSFilesFoundEventHandler>();
// 
//     private final Set<String> fileSet;
// 
//     public OSFilesFoundEvent(Set<String> fileSet) {
//         this.fileSet = fileSet;
//     }
// 
//     @Override
//     public ClientEventType<OSFilesFoundEventHandler> getHandlerType() {
//         return TYPE;
//     }
// 
//     @Override
//     public void dispatch(OSFilesFoundEventHandler handler) {
//         handler.handle(this.fileSet);
//     }
// 
//     public Set<String> getFileSet() {
//         return this.fileSet;
//     }
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/handlers/FilesIdentifiedEventHandler.java
// public interface FilesIdentifiedEventHandler extends ClientEventHandler {
// 
//     public void handle(TreeSet<File> fileSet);
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/handlers/HiddenFileFoundEventHandler.java
// public interface HiddenFileFoundEventHandler extends ClientEventHandler {
// 
//     void handle(File file);
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/handlers/OSFilesFoundEventHandler.java
// public interface OSFilesFoundEventHandler extends ClientEventHandler {
// 
//     public void handle(Set<String> fileSet);
// 
// }


import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import com.antelink.sourcesquare.event.base.EventBus;
import com.antelink.sourcesquare.event.events.FilesIdentifiedEvent;
import com.antelink.sourcesquare.event.events.HiddenFileFoundEvent;
import com.antelink.sourcesquare.event.events.OSFilesFoundEvent;
import com.antelink.sourcesquare.event.handlers.FilesIdentifiedEventHandler;
import com.antelink.sourcesquare.event.handlers.HiddenFileFoundEventHandler;
import com.antelink.sourcesquare.event.handlers.OSFilesFoundEventHandler;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
        {
            add("png");
            add("jpeg");
            add("jpg");
            add("bmp");
            add("gif");
            add("psd");
            add("tif");
            add("pcd");
            add("pct");
            add("pcx");
            add("pdf");
            add("pds");
            add("pic");
            add("pict");
            add("ps");
            add("psid");
            add("psp");
            add("pub");
            add("pif");
            add("pit");
            add("pnt");
        }
    };

    public BadgesProcessor(EventBus eventBus) {
        this.eventBus = eventBus;
    }

    public void bind() {
// Path: src/main/java/com/antelink/sourcesquare/event/base/EventBus.java
// public class EventBus {
// 
//     private static final Log logger = LogFactory.getLog(EventBus.class);
// 
//     HashMap<ClientEventType<?>, List<? extends ClientEventHandler>> eventMap = new HashMap<ClientEventType<?>, List<? extends ClientEventHandler>>();
// 
//     @SuppressWarnings("unchecked")
//     public <T extends ClientEventHandler> void addHandler(ClientEventType<T> eventType, T handler) {
//         if (!this.eventMap.containsKey(eventType)) {
//             this.eventMap.put(eventType, new ArrayList<T>());
//         }
//         ((ArrayList<T>) this.eventMap.get(eventType)).add(0, handler);
//     }
// 
//     @SuppressWarnings("unchecked")
//     public <T extends ClientEventHandler> void fireEvent(final ClientEvent<T> event) {
//         if (!this.eventMap.containsKey(event.getHandlerType())) {
//             return;
//         }
//         for (final ClientEventHandler handler : this.eventMap.get(event.getHandlerType())) {
//             try {
//                 Runnable runner = new Runnable() {
// 
//                     @Override
//                     public void run() { 
//                         event.dispatch((T) handler);
// 
//                     }
//                 };
// 
//                 Thread thread = new Thread(runner);
//                 thread.start();
// 
//                 logger.trace("event dispatched to the handler " + handler.getId());
//             } catch (Exception e) {
//                 logger.error("An event could not be dispatched to the handler " + handler.getId(), e);
//             }
//         }
//     }
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/events/FilesIdentifiedEvent.java
// public class FilesIdentifiedEvent implements ClientEvent<FilesIdentifiedEventHandler> {
// 
//     public static final ClientEventType<FilesIdentifiedEventHandler> TYPE = new ClientEventType<FilesIdentifiedEventHandler>();
// 
//     private final TreeSet<File> fileSet;
// 
//     public FilesIdentifiedEvent(TreeSet<File> fileSet) {
//         this.fileSet = fileSet;
//     }
// 
//     @Override
//     public ClientEventType<FilesIdentifiedEventHandler> getHandlerType() {
//         return TYPE;
//     }
// 
//     @Override
//     public void dispatch(FilesIdentifiedEventHandler handler) {
//         handler.handle(this.fileSet);
// 
//     }
// 
//     public TreeSet<File> getFileSet() {
//         return this.fileSet;
//     }
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/events/HiddenFileFoundEvent.java
// public class HiddenFileFoundEvent implements ClientEvent<HiddenFileFoundEventHandler> {
// 
//     public static final ClientEventType<HiddenFileFoundEventHandler> TYPE = new ClientEventType<HiddenFileFoundEventHandler>();
//     private File file;
// 
//     public HiddenFileFoundEvent(File file) {
//         this.file = file;
//     }
// 
//     @Override
//     public ClientEventType<HiddenFileFoundEventHandler> getHandlerType() {
//         return TYPE;
//     }
// 
//     @Override
//     public void dispatch(HiddenFileFoundEventHandler handler) {
//         handler.handle(this.file);
//     }
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/events/OSFilesFoundEvent.java
// public class OSFilesFoundEvent implements ClientEvent<OSFilesFoundEventHandler> {
// 
//     public static final ClientEventType<OSFilesFoundEventHandler> TYPE = new ClientEventType<OSFilesFoundEventHandler>();
// 
//     private final Set<String> fileSet;
// 
//     public OSFilesFoundEvent(Set<String> fileSet) {
//         this.fileSet = fileSet;
//     }
// 
//     @Override
//     public ClientEventType<OSFilesFoundEventHandler> getHandlerType() {
//         return TYPE;
//     }
// 
//     @Override
//     public void dispatch(OSFilesFoundEventHandler handler) {
//         handler.handle(this.fileSet);
//     }
// 
//     public Set<String> getFileSet() {
//         return this.fileSet;
//     }
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/handlers/FilesIdentifiedEventHandler.java
// public interface FilesIdentifiedEventHandler extends ClientEventHandler {
// 
//     public void handle(TreeSet<File> fileSet);
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/handlers/HiddenFileFoundEventHandler.java
// public interface HiddenFileFoundEventHandler extends ClientEventHandler {
// 
//     void handle(File file);
// 
// }
// 
// Path: src/main/java/com/antelink/sourcesquare/event/handlers/OSFilesFoundEventHandler.java
// public interface OSFilesFoundEventHandler extends ClientEventHandler {
// 
//     public void handle(Set<String> fileSet);
// 
// }


// Path: src/main/java/com/antelink/sourcesquare/badge/BadgesProcessor.java
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import com.antelink.sourcesquare.event.base.EventBus;
import com.antelink.sourcesquare.event.events.FilesIdentifiedEvent;
import com.antelink.sourcesquare.event.events.HiddenFileFoundEvent;
import com.antelink.sourcesquare.event.events.OSFilesFoundEvent;
import com.antelink.sourcesquare.event.handlers.FilesIdentifiedEventHandler;
import com.antelink.sourcesquare.event.handlers.HiddenFileFoundEventHandler;
import com.antelink.sourcesquare.event.handlers.OSFilesFoundEventHandler;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;

        {
            add("png");
            add("jpeg");
            add("jpg");
            add("bmp");
            add("gif");
            add("psd");
            add("tif");
            add("pcd");
            add("pct");
            add("pcx");
            add("pdf");
            add("pds");
            add("pic");
            add("pict");
            add("ps");
            add("psid");
            add("psp");
            add("pub");
            add("pif");
            add("pit");
            add("pnt");
        }
    };

    public BadgesProcessor(EventBus eventBus) {
        this.eventBus = eventBus;
    }

    public void bind() {
        this.eventBus.addHandler(FilesIdentifiedEvent.TYPE, new FilesIdentifiedEventHandler() {