Project

General

Profile

« Previous | Next » 

Revision ecd0d355

Added by Ben Stöver over 7 years ago

Messages edited.
Support for parameters to export only single reads or only consensus implemented.
JavaDoc extended.

View differences:

eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SequenceIDIterator.java
21 21
 * @date 29.04.2016
22 22
 */
23 23
class SequenceIDIterator implements Iterator<String> {
24
    private boolean containsConsensus;
24 25
    private int singleReadPos;
25 26
    private int singleReadCount;
26 27

  
......
30 31
     *
31 32
     * @param singleReadCount the number of single read IDs to be returned by this iterator before the consensus sequence
32 33
     */
33
    public SequenceIDIterator(int singleReadCount) {
34
    public SequenceIDIterator(int singleReadCount, boolean containsConsensus) {
34 35
        super();
36
        this.containsConsensus = containsConsensus;
35 37
        this.singleReadCount = singleReadCount;
36 38
        this.singleReadPos = 0;
37 39
    }
......
39 41

  
40 42
    @Override
41 43
    public boolean hasNext() {
42
        return singleReadPos <= singleReadCount;
44
        return (singleReadPos < singleReadCount) || (containsConsensus && (singleReadPos <= singleReadCount));
43 45
    }
44 46

  
45 47

  
......
48 50
        if (singleReadPos < singleReadCount) {
49 51
            return CDMSequenceMatrixAdapter.SINGLE_READ_SEQUENCE_ID_PREFIX + (singleReadPos++);
50 52
        }
51
        else if (singleReadPos == singleReadCount) {
53
        else if (containsConsensus && (singleReadPos == singleReadCount)) {
52 54
            singleReadPos++;
53 55
            return CDMSequenceMatrixAdapter.CONSENSUS_SEQUENCE_ID;
54 56
        }

Also available in: Unified diff