// Path: src/main/java/abra/Logger.java
// public class Logger {
// 	
// 	enum Level { TRACE, DEBUG, INFO, WARN, ERROR };
// 	
// 	public static Level LEVEL = Level.INFO;
// 	
// 	private static Map<String, Level> stringToLevel;
// 	
// 	static {
// 		stringToLevel = new HashMap<String, Level>();
// 		stringToLevel.put("TRACE", Level.TRACE);
// 		stringToLevel.put("DEBUG", Level.DEBUG);
// 		stringToLevel.put("INFO", Level.INFO);
// 		stringToLevel.put("WARN", Level.WARN);
// 		stringToLevel.put("ERROR", Level.ERROR);
// 	}
// 	
// 	// For trace or debug messages, use varargs to avoid string concatenation unless enabled
// 	
// 	public static void trace(String format, Object... args) {
// 		if (LEVEL == Level.TRACE) {
// 			log(String.format(format, args), Level.TRACE);
// 		}
// 	}
// 	
// 	public static void debug(String format, Object... args) {
// 		if (LEVEL == Level.DEBUG || LEVEL == Level.TRACE) {
// 			log(String.format(format, args), Level.DEBUG);
// 		}
// 	}
// 	
// 	public static void info(String format, Object... args) {
// 		if (LEVEL == Level.TRACE || LEVEL == Level.DEBUG || LEVEL == Level.INFO) {
// 			log(String.format(format, args), Level.INFO);
// 		}
// 	}
// 		
// 	public static void warn(String message) {
// 		if (LEVEL == Level.TRACE || LEVEL == Level.DEBUG || LEVEL == Level.INFO || LEVEL == Level.WARN) {
// 			log(message, Level.WARN);
// 		}
// 	}
// 	
// 	public static void error(String message) {
// 		log(message, Level.ERROR);
// 	}
// 	
// 	public static void setLevel(String str) {
// 		Level level = stringToLevel.get(str.toUpperCase());
// 		if (level == null) {
// 			throw new IllegalArgumentException("Log level must be one of trace, debug, info, warn or error.");
// 		}
// 		
// 		Logger.LEVEL = level;
// 	}
// 	
// 	public static void log(String message, Level level) {
// 		
// 		String levelStr = "UNKNOWN";
// 		
// 		switch (level) {
// 			case ERROR:
// 				levelStr = "ERROR";
// 				break;
// 			case WARN:
// 				levelStr = "WARNING";
// 				break;
// 			case INFO:
// 				levelStr = "INFO";
// 				break;
// 			case DEBUG:
// 				levelStr = "DEBUG";
// 				break;
// 			case TRACE:
// 				levelStr = "TRACE";
// 				break;
// 		}
// 		
// 		System.err.println(levelStr + "\t" + new Date() + "\t" + message);
// 	}
// }


import htsjdk.samtools.Defaults;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.TreeSet;
import abra.Logger;

        if (this.numRecordsInRam > 0) {
            spillToDisk();
        }

        // Facilitate GC
        this.ramRecords = null;
    }

    /**
     * @return True if this collection is allowed to discard data during iteration in order to reduce memory
     * footprint, precluding a second iteration over the collection.
     */
    public boolean isDestructiveIteration() {
        return destructiveIteration;
    }

    /**
     * Tell this collection that it is allowed to discard data during iteration in order to reduce memory footprint,
     * precluding a second iteration.  This is true by default.
     */
    public void setDestructiveIteration(boolean destructiveIteration) {
        this.destructiveIteration = destructiveIteration;
    }

    /**
     * Sort the records in memory, write them to a file, and clear the buffer of records in memory.
     */
    private void spillToDisk() {
        try {
// Path: src/main/java/abra/Logger.java
// public class Logger {
// 	
// 	enum Level { TRACE, DEBUG, INFO, WARN, ERROR };
// 	
// 	public static Level LEVEL = Level.INFO;
// 	
// 	private static Map<String, Level> stringToLevel;
// 	
// 	static {
// 		stringToLevel = new HashMap<String, Level>();
// 		stringToLevel.put("TRACE", Level.TRACE);
// 		stringToLevel.put("DEBUG", Level.DEBUG);
// 		stringToLevel.put("INFO", Level.INFO);
// 		stringToLevel.put("WARN", Level.WARN);
// 		stringToLevel.put("ERROR", Level.ERROR);
// 	}
// 	
// 	// For trace or debug messages, use varargs to avoid string concatenation unless enabled
// 	
// 	public static void trace(String format, Object... args) {
// 		if (LEVEL == Level.TRACE) {
// 			log(String.format(format, args), Level.TRACE);
// 		}
// 	}
// 	
// 	public static void debug(String format, Object... args) {
// 		if (LEVEL == Level.DEBUG || LEVEL == Level.TRACE) {
// 			log(String.format(format, args), Level.DEBUG);
// 		}
// 	}
// 	
// 	public static void info(String format, Object... args) {
// 		if (LEVEL == Level.TRACE || LEVEL == Level.DEBUG || LEVEL == Level.INFO) {
// 			log(String.format(format, args), Level.INFO);
// 		}
// 	}
// 		
// 	public static void warn(String message) {
// 		if (LEVEL == Level.TRACE || LEVEL == Level.DEBUG || LEVEL == Level.INFO || LEVEL == Level.WARN) {
// 			log(message, Level.WARN);
// 		}
// 	}
// 	
// 	public static void error(String message) {
// 		log(message, Level.ERROR);
// 	}
// 	
// 	public static void setLevel(String str) {
// 		Level level = stringToLevel.get(str.toUpperCase());
// 		if (level == null) {
// 			throw new IllegalArgumentException("Log level must be one of trace, debug, info, warn or error.");
// 		}
// 		
// 		Logger.LEVEL = level;
// 	}
// 	
// 	public static void log(String message, Level level) {
// 		
// 		String levelStr = "UNKNOWN";
// 		
// 		switch (level) {
// 			case ERROR:
// 				levelStr = "ERROR";
// 				break;
// 			case WARN:
// 				levelStr = "WARNING";
// 				break;
// 			case INFO:
// 				levelStr = "INFO";
// 				break;
// 			case DEBUG:
// 				levelStr = "DEBUG";
// 				break;
// 			case TRACE:
// 				levelStr = "TRACE";
// 				break;
// 		}
// 		
// 		System.err.println(levelStr + "\t" + new Date() + "\t" + message);
// 	}
// }


// Path: src/main/java/htsjdk/samtools/util/SortingCollection2.java
import htsjdk.samtools.Defaults;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.TreeSet;
import abra.Logger;


        if (this.numRecordsInRam > 0) {
            spillToDisk();
        }

        // Facilitate GC
        this.ramRecords = null;
    }

    /**
     * @return True if this collection is allowed to discard data during iteration in order to reduce memory
     * footprint, precluding a second iteration over the collection.
     */
    public boolean isDestructiveIteration() {
        return destructiveIteration;
    }

    /**
     * Tell this collection that it is allowed to discard data during iteration in order to reduce memory footprint,
     * precluding a second iteration.  This is true by default.
     */
    public void setDestructiveIteration(boolean destructiveIteration) {
        this.destructiveIteration = destructiveIteration;
    }

    /**
     * Sort the records in memory, write them to a file, and clear the buffer of records in memory.
     */
    private void spillToDisk() {
        try {
        	Logger.info("Sort Spilling to disk...");