/** * Non-comprehensive {@link #equals(Object)}-validation: instead of calling {@link SAMSequenceRecord#equals(Object)} on constituent * {@link SAMSequenceRecord}s in this dictionary against its pair in the target dictionary, in order, call * {@link SAMSequenceRecord#isSameSequence(SAMSequenceRecord)}. * * @param that {@link SAMSequenceDictionary} to compare against * @return true if the dictionaries are the same, false otherwise * */ public boolean isSameDictionary(final SAMSequenceDictionary that) { if (that == null || that.mSequences == null) return false; if (this == that) return true; final Iterator<SAMSequenceRecord> thatSequences = that.mSequences.iterator(); for (final SAMSequenceRecord thisSequence : mSequences) { if (!thatSequences.hasNext()) { return false; } else { final SAMSequenceRecord thatSequence = thatSequences.next(); if (!thatSequence.isSameSequence(thisSequence)) { return false; } } } return !thatSequences.hasNext(); }
/** * Non-comprehensive {@link #equals(Object)}-validation: instead of calling {@link SAMSequenceRecord#equals(Object)} on constituent * {@link SAMSequenceRecord}s in this dictionary against its pair in the target dictionary, in order, call * {@link SAMSequenceRecord#isSameSequence(SAMSequenceRecord)}. * * @param that {@link SAMSequenceDictionary} to compare against * @return true if the dictionaries are the same, false otherwise * */ public boolean isSameDictionary(final SAMSequenceDictionary that) { if (that == null || that.mSequences == null) return false; if (this == that) return true; final Iterator<SAMSequenceRecord> thatSequences = that.mSequences.iterator(); for (final SAMSequenceRecord thisSequence : mSequences) { if (!thatSequences.hasNext()) { return false; } else { final SAMSequenceRecord thatSequence = thatSequences.next(); if (!thatSequence.isSameSequence(thisSequence)) { return false; } } } return !thatSequences.hasNext(); }
/** * Non-comprehensive {@link #equals(Object)}-assertion: instead of calling {@link SAMSequenceRecord#equals(Object)} on constituent * {@link SAMSequenceRecord}s in this dictionary against its pair in the target dictionary, in order, call * {@link SAMSequenceRecord#isSameSequence(SAMSequenceRecord)}. * * @throws AssertionError When the dictionaries are not the same, with some human-readable information as to why */ public void assertSameDictionary(final SAMSequenceDictionary that) { if (this == that) return; final Iterator<SAMSequenceRecord> thatSequences = that.mSequences.iterator(); for (final SAMSequenceRecord thisSequence : mSequences) { if (!thatSequences.hasNext()) throw new AssertionError(String.format(DICT_MISMATCH_TEMPLATE, thisSequence + " is present in only one dictionary")); else { final SAMSequenceRecord thatSequence = thatSequences.next(); if(!thatSequence.isSameSequence(thisSequence)) throw new AssertionError( String.format(DICT_MISMATCH_TEMPLATE, thatSequence + " was found when " + thisSequence + " was expected") ); } } if (thatSequences.hasNext()) throw new AssertionError(String.format(DICT_MISMATCH_TEMPLATE, thatSequences.next() + " is present in only one dictionary")); }
/** * Non-comprehensive {@link #equals(Object)}-assertion: instead of calling {@link SAMSequenceRecord#equals(Object)} on constituent * {@link SAMSequenceRecord}s in this dictionary against its pair in the target dictionary, in order, call * {@link SAMSequenceRecord#isSameSequence(SAMSequenceRecord)}. * Aliases are ignored. * * @throws AssertionError When the dictionaries are not the same, with some human-readable information as to why */ public void assertSameDictionary(final SAMSequenceDictionary that) { if (this == that) return; final Iterator<SAMSequenceRecord> thatSequences = that.mSequences.iterator(); for (final SAMSequenceRecord thisSequence : mSequences) { if (!thatSequences.hasNext()) { throw new AssertionError(String.format(DICT_MISMATCH_TEMPLATE, thisSequence + " is present in only one dictionary")); } else { final SAMSequenceRecord thatSequence = thatSequences.next(); if(!thatSequence.isSameSequence(thisSequence)) { throw new AssertionError( String.format(DICT_MISMATCH_TEMPLATE, thatSequence + " was found when " + thisSequence + " was expected") ); } } } if (thatSequences.hasNext()) throw new AssertionError(String.format(DICT_MISMATCH_TEMPLATE, thatSequences.next() + " is present in only one dictionary")); }
/** * Non-comprehensive {@link #equals(Object)}-assertion: instead of calling {@link SAMSequenceRecord#equals(Object)} on constituent * {@link SAMSequenceRecord}s in this dictionary against its pair in the target dictionary, in order, call * {@link SAMSequenceRecord#isSameSequence(SAMSequenceRecord)}. * Aliases are ignored. * * @throws AssertionError When the dictionaries are not the same, with some human-readable information as to why */ public void assertSameDictionary(final SAMSequenceDictionary that) { if (this == that) return; final Iterator<SAMSequenceRecord> thatSequences = that.mSequences.iterator(); for (final SAMSequenceRecord thisSequence : mSequences) { if (!thatSequences.hasNext()) { throw new AssertionError(String.format(DICT_MISMATCH_TEMPLATE, thisSequence + " is present in only one dictionary")); } else { final SAMSequenceRecord thatSequence = thatSequences.next(); if(!thatSequence.isSameSequence(thisSequence)) { throw new AssertionError( String.format(DICT_MISMATCH_TEMPLATE, thatSequence + " was found when " + thisSequence + " was expected") ); } } } if (thatSequences.hasNext()) throw new AssertionError(String.format(DICT_MISMATCH_TEMPLATE, thatSequences.next() + " is present in only one dictionary")); }
if (!s1.get(i).isSameSequence(s2.get(i))) { String s1Attrs = ""; for (final java.util.Map.Entry<String, String> entry : s1.get(i)
if (!s1.get(i).isSameSequence(s2.get(i))) { String s1Attrs = ""; for (final java.util.Map.Entry<String, String> entry : s1.get(i)
if (!s1.get(i).isSameSequence(s2.get(i))) { String s1Attrs = ""; for (final java.util.Map.Entry<String, String> entry : s1.get(i)
@Test(dataProvider = "testIsSameSequenceData") public void testIsSameSequence(final SAMSequenceRecord rec1 , final SAMSequenceRecord rec2, final String md5One, final String md5Two, final int index1, final int index2, final boolean isSame) { if (rec2 != null) { rec2.setMd5(md5Two); rec2.setSequenceIndex(index2); } if (rec1 != null) { rec1.setMd5(md5One); rec1.setSequenceIndex(index1); Assert.assertEquals(rec1.isSameSequence(rec2), isSame); } }