EMMA Coverage Report (generated Tue Mar 14 21:50:42 EST 2006)
[all classes][org.farng.mp3.lyrics3]

COVERAGE SUMMARY FOR SOURCE FILE [Lyrics3v1Iterator.java]

nameclass, %method, %block, %line, %
Lyrics3v1Iterator.java0%   (0/1)0%   (0/4)0%   (0/103)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Lyrics3v1Iterator0%   (0/1)0%   (0/4)0%   (0/103)0%   (0/19)
Lyrics3v1Iterator (Lyrics3v1): void 0%   (0/1)0%   (0/15)0%   (0/6)
hasNext (): boolean 0%   (0/1)0%   (0/19)0%   (0/1)
next (): Object 0%   (0/1)0%   (0/44)0%   (0/9)
remove (): void 0%   (0/1)0%   (0/25)0%   (0/3)

1package org.farng.mp3.lyrics3;
2 
3import java.util.Iterator;
4import java.util.NoSuchElementException;
5 
6/**
7 * This is a manual iterator for a Lyrics3v1 tag
8 *
9 * @author Eric Farng
10 * @version $Revision: 1.4 $
11 */
12public class Lyrics3v1Iterator implements Iterator {
13 
14    private Lyrics3v1 tag = null;
15    private int lastIndex = 0;
16    private int removeIndex = 0;
17 
18    /**
19     * Creates a new Lyrics3v1Iterator object.
20     */
21    public Lyrics3v1Iterator(final Lyrics3v1 lyrics3v1Tag) {
22        this.tag = lyrics3v1Tag;
23    }
24 
25    public boolean hasNext() {
26        return !((this.tag.getLyric().indexOf('\n', this.lastIndex) < 0) &&
27                 (this.lastIndex > this.tag.getLyric().length()));
28    }
29 
30    public Object next() {
31        final int nextIndex = this.tag.getLyric().indexOf('\n', this.lastIndex);
32        this.removeIndex = this.lastIndex;
33        final String line;
34        if (this.lastIndex >= 0) {
35            if (nextIndex >= 0) {
36                line = this.tag.getLyric().substring(this.lastIndex, nextIndex);
37            } else {
38                line = this.tag.getLyric().substring(this.lastIndex);
39            }
40            this.lastIndex = nextIndex;
41        } else {
42            throw new NoSuchElementException("Iteration has no more elements.");
43        }
44        return line;
45    }
46 
47    public void remove() {
48        final String lyric = this.tag.getLyric().substring(0, this.removeIndex) +
49                             this.tag.getLyric().substring(this.lastIndex);
50        this.tag.setLyric(lyric);
51    }
52}

[all classes][org.farng.mp3.lyrics3]
EMMA 2.0.5312 (C) Vladimir Roubtsov