All Downloads are FREE. Search and download functionalities are using the official Maven repository.

htsjdk.samtools.util.ComparableTuple Maven / Gradle / Ivy

There is a newer version: 4.1.3
Show newest version
package htsjdk.samtools.util;

/**
 * A simple extension of the Tuple class that, for comparable Types, allows comparing Tuples of non-null elements.
 * 

* The comparison will compare the first arguments and if equal (compareTo returns 0) compare the second arguments. * * @author farjoun */ public class ComparableTuple, B extends Comparable> extends Tuple implements Comparable> { public ComparableTuple(final A a, final B b) { super(a, b); if (a == null || b == null) { throw new IllegalArgumentException("ComparableTuple's behavior is undefined when containing a null."); } } @Override public int compareTo(final ComparableTuple o) { int retval = a.compareTo(o.a); if (retval == 0) { retval = b.compareTo(o.b); } return retval; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy