SimpleSequencePair extends SimpleProfile<S, C> implements SequencePair<S, C> { @Override public int getNumSimilars() { if (similars == -1) { similars = 0; for (int i = 1; i <= getLength(); i++) { C c1 = getCompoundInQueryAt(i); C c2 = getCompoundInTargetAt(i); if ( c1 instanceof AminoAcidCompound && c2 instanceof AminoAcidCompound) { short value = matrix.getValue((AminoAcidCompound)c1, (AminoAcidCompound)c2); if ( value > 0) similars++; } else { if (getCompoundSet().compoundsEquivalent(c1,c2)) { similars++; } } } getQuery().clearCache(); getTarget().clearCache(); } return similars; } SimpleSequencePair(AlignedSequence<S, C> query, AlignedSequence<S, C> target);  SimpleSequencePair(S query, S target, List<Step> sx, List<Step> sy);  SimpleSequencePair(S query, S target, List<Step> sx, int xb, int xa, List<Step> sy, int yb, int ya); @Override C getCompoundInQueryAt(int alignmentIndex); @Override C getCompoundInTargetAt(int alignmentIndex); @Override int getIndexInQueryAt(int alignmentIndex); @Override int getIndexInQueryForTargetAt(int targetIndex); @Override int getIndexInTargetAt(int alignmentIndex); @Override int getIndexInTargetForQueryAt(int queryIndex); @Override int getNumIdenticals(); @Override int getNumSimilars(); @Override AlignedSequence<S, C> getQuery(); @Override AlignedSequence<S, C> getTarget();  }
@Test public void testGetNumSimilars() { assertEquals(global.getNumSimilars(), 2); assertEquals(local.getNumSimilars(), 2); }