/** * Equals method that agrees with {@link #compareTo(Interval)}. */ public boolean equals(final Object other) { if (!(other instanceof Interval)) return false; else if (this == other) return true; else { Interval that = (Interval) other; return (this.compareTo(that) == 0); } }
/** Equals method that agrees with {@link #compareTo(Interval)}. */ public boolean equals(final Object other) { if (!(other instanceof Interval)) return false; else if (this == other) return true; else { Interval that = (Interval)other; return (this.compareTo(that) == 0); } }
/** * Equals method that agrees with {@link #compareTo(Interval)}. */ public boolean equals(final Object other) { if (!(other instanceof Interval)) return false; else if (this == other) return true; else { Interval that = (Interval) other; return (this.compareTo(that) == 0); } }
public int compareTo(final Gene that) { final int ret = super.compareTo(that); if (ret != 0) return ret; return Boolean.valueOf(this.isPositiveStrand()).compareTo(that.isPositiveStrand()); }
public int compareTo(final Gene that) { final int ret = super.compareTo(that); if (ret != 0) return ret; return Boolean.valueOf(this.isPositiveStrand()).compareTo(that.isPositiveStrand()); }
/** * Throws RuntimeException if the given intervals are not locus ordered and non-overlapping * * @param intervals * @param sequenceDictionary used to determine order of sequences */ public static void assertOrderedNonOverlapping(final Iterator<Interval> intervals, final SAMSequenceDictionary sequenceDictionary) { if (!intervals.hasNext()) { return; } Interval prevInterval = intervals.next(); int prevSequenceIndex = sequenceDictionary.getSequenceIndex(prevInterval.getContig()); while (intervals.hasNext()) { final Interval interval = intervals.next(); if (prevInterval.intersects(interval)) { throw new SAMException("Intervals should not overlap: " + prevInterval + "; " + interval); } final int thisSequenceIndex = sequenceDictionary.getSequenceIndex(interval.getContig()); if (prevSequenceIndex > thisSequenceIndex || (prevSequenceIndex == thisSequenceIndex && prevInterval.compareTo(interval) >= 0)) { throw new SAMException("Intervals not in order: " + prevInterval + "; " + interval); } prevInterval = interval; prevSequenceIndex = thisSequenceIndex; } } }
/** * Throws RuntimeException if the given intervals are not locus ordered and non-overlapping * @param intervals * @param sequenceDictionary used to determine order of sequences */ public static void assertOrderedNonOverlapping(final Iterator<Interval> intervals, final SAMSequenceDictionary sequenceDictionary) { if (!intervals.hasNext()) { return; } Interval prevInterval = intervals.next(); int prevSequenceIndex = sequenceDictionary.getSequenceIndex(prevInterval.getSequence()); while (intervals.hasNext()) { final Interval interval = intervals.next(); if (prevInterval.intersects(interval)) { throw new SAMException("Intervals should not overlap: " + prevInterval + "; " + interval); } final int thisSequenceIndex = sequenceDictionary.getSequenceIndex(interval.getSequence()); if (prevSequenceIndex > thisSequenceIndex || (prevSequenceIndex == thisSequenceIndex && prevInterval.compareTo(interval) >= 0)) { throw new SAMException("Intervals not in order: " + prevInterval + "; " + interval); } prevInterval = interval; prevSequenceIndex = thisSequenceIndex; } } }
/** * Throws RuntimeException if the given intervals are not locus ordered and non-overlapping * * @param intervals * @param sequenceDictionary used to determine order of sequences */ public static void assertOrderedNonOverlapping(final Iterator<Interval> intervals, final SAMSequenceDictionary sequenceDictionary) { if (!intervals.hasNext()) { return; } Interval prevInterval = intervals.next(); int prevSequenceIndex = sequenceDictionary.getSequenceIndex(prevInterval.getContig()); while (intervals.hasNext()) { final Interval interval = intervals.next(); if (prevInterval.intersects(interval)) { throw new SAMException("Intervals should not overlap: " + prevInterval + "; " + interval); } final int thisSequenceIndex = sequenceDictionary.getSequenceIndex(interval.getContig()); if (prevSequenceIndex > thisSequenceIndex || (prevSequenceIndex == thisSequenceIndex && prevInterval.compareTo(interval) >= 0)) { throw new SAMException("Intervals not in order: " + prevInterval + "; " + interval); } prevInterval = interval; prevSequenceIndex = thisSequenceIndex; } } }