// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java
// public class Logger {
//     /*
//      * levels of debugging
//      * 0: INFO
//      * 1: DEBUG
//      * 2: EXCEPTION
//      * 3:ALL
//      */
//     private static int LEVEL = 2;
//     private static final int EXCEPTION = 2;
//     private static final int DEBUG = 1;
//     private static final int INFO = 0;
//     
//     
//     // TODO use configuration set LEVEL
//     public static void SETLEVEL(int NEWLEVEL) {
//         LEVEL = NEWLEVEL;
//     }
//     
//     public static void EXCEPTION(Exception ex){
//         if (LEVEL >= EXCEPTION) {
//             System.err.println("[EXCEPTION] " + ex.getLocalizedMessage());
//             ex.printStackTrace();
//         }
//     }
//     
//     public static void THROWABLE(Throwable ex){
//         if (LEVEL >= EXCEPTION) {
//             System.err.println("[EXCEPTION] " + ex.getLocalizedMessage());
//             ex.printStackTrace();
//         }
//     }
//     
//     public static void DEBUG(String message) {
//         if(LEVEL >= DEBUG)
//             System.err.println("[" + Timer.getGlobalTime() + " - DEBUG] " + message);
//     }
//     
//     public static void INFO(String message) {
//         if(LEVEL >= INFO)
//             System.err.println("[INFO] " + message);
//     }
//     
//     public static void DEBUG(String message, int level) {
//         if(LEVEL >= level)
//             System.err.println("[" + Timer.getGlobalTime() + " - DEBUG] " + message);
//     }
// }


import be.ugent.intec.halvade.uploader.Logger;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;
            allReaders = new FileReaderFactory(threads, fromHDFS);
        }
        return allReaders;
    }
    
    public static BaseFileReader createFileReader(boolean fromHDFS, String fileA, String fileB, boolean interleaved) throws IOException {
        if (fileB == null) {
            return new SingleFastQReader(fromHDFS, fileA, interleaved);
        } else {
            return new PairedFastQReader(fromHDFS, fileA, fileB);
        }     
    }
    
    public void addReader(String fileA, String fileB, boolean interleaved) throws IOException {
        readers.add(createFileReader(fromHDFS, fileA, fileB, interleaved));
    }
    
    public void addReader(BaseFileReader reader) {
        readers.add(reader);
    }

    
    public ReadBlock retrieveBlock() {
        try {
            ReadBlock block = null;
            while((check || blocks.size() > 0) && block == null) {
                block = blocks.poll(1000, TimeUnit.MILLISECONDS);
            }
            return block;
        } catch (InterruptedException ex) {
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java
// public class Logger {
//     /*
//      * levels of debugging
//      * 0: INFO
//      * 1: DEBUG
//      * 2: EXCEPTION
//      * 3:ALL
//      */
//     private static int LEVEL = 2;
//     private static final int EXCEPTION = 2;
//     private static final int DEBUG = 1;
//     private static final int INFO = 0;
//     
//     
//     // TODO use configuration set LEVEL
//     public static void SETLEVEL(int NEWLEVEL) {
//         LEVEL = NEWLEVEL;
//     }
//     
//     public static void EXCEPTION(Exception ex){
//         if (LEVEL >= EXCEPTION) {
//             System.err.println("[EXCEPTION] " + ex.getLocalizedMessage());
//             ex.printStackTrace();
//         }
//     }
//     
//     public static void THROWABLE(Throwable ex){
//         if (LEVEL >= EXCEPTION) {
//             System.err.println("[EXCEPTION] " + ex.getLocalizedMessage());
//             ex.printStackTrace();
//         }
//     }
//     
//     public static void DEBUG(String message) {
//         if(LEVEL >= DEBUG)
//             System.err.println("[" + Timer.getGlobalTime() + " - DEBUG] " + message);
//     }
//     
//     public static void INFO(String message) {
//         if(LEVEL >= INFO)
//             System.err.println("[INFO] " + message);
//     }
//     
//     public static void DEBUG(String message, int level) {
//         if(LEVEL >= level)
//             System.err.println("[" + Timer.getGlobalTime() + " - DEBUG] " + message);
//     }
// }


// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/input/FileReaderFactory.java
import be.ugent.intec.halvade.uploader.Logger;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;

            allReaders = new FileReaderFactory(threads, fromHDFS);
        }
        return allReaders;
    }
    
    public static BaseFileReader createFileReader(boolean fromHDFS, String fileA, String fileB, boolean interleaved) throws IOException {
        if (fileB == null) {
            return new SingleFastQReader(fromHDFS, fileA, interleaved);
        } else {
            return new PairedFastQReader(fromHDFS, fileA, fileB);
        }     
    }
    
    public void addReader(String fileA, String fileB, boolean interleaved) throws IOException {
        readers.add(createFileReader(fromHDFS, fileA, fileB, interleaved));
    }
    
    public void addReader(BaseFileReader reader) {
        readers.add(reader);
    }

    
    public ReadBlock retrieveBlock() {
        try {
            ReadBlock block = null;
            while((check || blocks.size() > 0) && block == null) {
                block = blocks.poll(1000, TimeUnit.MILLISECONDS);
            }
            return block;
        } catch (InterruptedException ex) {
            Logger.EXCEPTION(ex);