// Path: src/main/java/org/seqdoop/hadoop_bam/FormatException.java
// public class FormatException extends RuntimeException
// {
// 	private static final long serialVersionUID = 1L;
// 	public FormatException(String msg)
// 	{
// 		super(msg);
// 	}
// }


import com.google.common.collect.ImmutableList;
import htsjdk.samtools.util.Interval;
import org.apache.hadoop.conf.Configuration;
import org.seqdoop.hadoop_bam.FormatException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
package org.seqdoop.hadoop_bam.util;



/**
 * Common utilities across different file formats.
 */
public final class IntervalUtil {

    // declared to prevent instantiation.
    private IntervalUtil() {}

    /**
     * Returns the list of intervals found in a string configuration property separated by colons.
     * @param conf the source configuration.
     * @param intervalPropertyName the property name holding the intervals.
     * @return {@code null} if there is no such a property in the configuration.
     * @throws NullPointerException if either input is null.
     */
    public static List<Interval> getIntervals(final Configuration conf, final String intervalPropertyName) {
        final String intervalsProperty = conf.get(intervalPropertyName);
        if (intervalsProperty == null) {
            return null;
        }
        if (intervalsProperty.isEmpty()) {
            return ImmutableList.of();
        }
        final List<Interval> intervals = new ArrayList<>();
        for (final String s : intervalsProperty.split(",")) {
            final int lastColonIdx = s.lastIndexOf(':');
            if (lastColonIdx < 0) {
// Path: src/main/java/org/seqdoop/hadoop_bam/FormatException.java
// public class FormatException extends RuntimeException
// {
// 	private static final long serialVersionUID = 1L;
// 	public FormatException(String msg)
// 	{
// 		super(msg);
// 	}
// }


// Path: src/main/java/org/seqdoop/hadoop_bam/util/IntervalUtil.java
import com.google.common.collect.ImmutableList;
import htsjdk.samtools.util.Interval;
import org.apache.hadoop.conf.Configuration;
import org.seqdoop.hadoop_bam.FormatException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

package org.seqdoop.hadoop_bam.util;



/**
 * Common utilities across different file formats.
 */
public final class IntervalUtil {

    // declared to prevent instantiation.
    private IntervalUtil() {}

    /**
     * Returns the list of intervals found in a string configuration property separated by colons.
     * @param conf the source configuration.
     * @param intervalPropertyName the property name holding the intervals.
     * @return {@code null} if there is no such a property in the configuration.
     * @throws NullPointerException if either input is null.
     */
    public static List<Interval> getIntervals(final Configuration conf, final String intervalPropertyName) {
        final String intervalsProperty = conf.get(intervalPropertyName);
        if (intervalsProperty == null) {
            return null;
        }
        if (intervalsProperty.isEmpty()) {
            return ImmutableList.of();
        }
        final List<Interval> intervals = new ArrayList<>();
        for (final String s : intervalsProperty.split(",")) {
            final int lastColonIdx = s.lastIndexOf(':');
            if (lastColonIdx < 0) {
                throw new FormatException("no colon found in interval string: " + s);