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

COVERAGE SUMMARY FOR SOURCE FILE [ObjectLyrics3Line.java]

nameclass, %method, %block, %line, %
ObjectLyrics3Line.java100% (1/1)75%  (12/16)58%  (190/328)61%  (38.8/64)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ObjectLyrics3Line100% (1/1)75%  (12/16)58%  (190/328)61%  (38.8/64)
addLyric (ObjectID3v2LyricLine): void 0%   (0/1)0%   (0/13)0%   (0/2)
addLyric (String): void 0%   (0/1)0%   (0/12)0%   (0/2)
addTimeStamp (ObjectLyrics3TimeStamp): void 0%   (0/1)0%   (0/6)0%   (0/2)
readString (String, int): void 0%   (0/1)0%   (0/77)0%   (0/14)
getSize (): int 100% (1/1)58%  (15/26)61%  (2.4/4)
toString (): String 100% (1/1)62%  (25/40)59%  (2.4/4)
equals (Object): boolean 100% (1/1)86%  (24/28)75%  (6/8)
ObjectLyrics3Line (ObjectLyrics3Line): void 100% (1/1)100% (42/42)100% (8/8)
ObjectLyrics3Line (String): void 100% (1/1)100% (14/14)100% (5/5)
getLyric (): String 100% (1/1)100% (3/3)100% (1/1)
getTimeStamp (): Iterator 100% (1/1)100% (4/4)100% (1/1)
hasTimeStamp (): boolean 100% (1/1)100% (8/8)100% (3/3)
setLyric (ObjectID3v2LyricLine): void 100% (1/1)100% (5/5)100% (2/2)
setLyric (String): void 100% (1/1)100% (4/4)100% (2/2)
setTimeStamp (ObjectLyrics3TimeStamp): void 100% (1/1)100% (9/9)100% (3/3)
writeString (): String 100% (1/1)100% (37/37)100% (5/5)

1package org.farng.mp3.object;
2 
3import java.util.Iterator;
4import java.util.LinkedList;
5 
6/**
7 * ID3v2 and Lyrics3v2 tags have individual fields <code>AbstractMP3Fragment</code>s Then each fragment is broken down
8 * in to individual <code>AbstractMP3Object</code>s
9 *
10 * @author Eric Farng
11 * @version $Revision: 1.5 $
12 */
13public class ObjectLyrics3Line extends AbstractMP3Object {
14 
15    private LinkedList timeStamp = new LinkedList();
16    private String lyric = "";
17 
18    /**
19     * Creates a new ObjectLyrics3Line object.
20     */
21    public ObjectLyrics3Line(final String identifier) {
22        this.identifier = identifier;
23    }
24 
25    /**
26     * Creates a new ObjectLyrics3Line object.
27     */
28    public ObjectLyrics3Line(final ObjectLyrics3Line copyObject) {
29        super(copyObject);
30        this.lyric = new String(copyObject.lyric);
31        ObjectLyrics3TimeStamp newTimeStamp;
32        for (int i = 0; i < copyObject.timeStamp.size(); i++) {
33            newTimeStamp = new ObjectLyrics3TimeStamp((ObjectLyrics3TimeStamp) copyObject.timeStamp.get(i));
34            this.timeStamp.add(newTimeStamp);
35        }
36    }
37 
38    public void setLyric(final String lyric) {
39        this.lyric = lyric;
40    }
41 
42    public void setLyric(final ObjectID3v2LyricLine line) {
43        this.lyric = line.getText();
44    }
45 
46    public String getLyric() {
47        return this.lyric;
48    }
49 
50    public int getSize() {
51        int size = 0;
52        for (int i = 0; i < this.timeStamp.size(); i++) {
53            size += ((ObjectLyrics3TimeStamp) this.timeStamp.get(i)).getSize();
54        }
55        return size + this.lyric.length();
56    }
57 
58    public void setTimeStamp(final ObjectLyrics3TimeStamp time) {
59        this.timeStamp.clear();
60        this.timeStamp.add(time);
61    }
62 
63    public Iterator getTimeStamp() {
64        return this.timeStamp.iterator();
65    }
66 
67    public void addLyric(final String newLyric) {
68        this.lyric += newLyric;
69    }
70 
71    public void addLyric(final ObjectID3v2LyricLine line) {
72        this.lyric += line.getText();
73    }
74 
75    public void addTimeStamp(final ObjectLyrics3TimeStamp time) {
76        this.timeStamp.add(time);
77    }
78 
79    public boolean equals(final Object obj) {
80        if ((obj instanceof ObjectLyrics3Line) == false) {
81            return false;
82        }
83        final ObjectLyrics3Line objectLyrics3Line = (ObjectLyrics3Line) obj;
84        if (this.lyric.equals(objectLyrics3Line.lyric) == false) {
85            return false;
86        }
87        if (this.timeStamp.equals(objectLyrics3Line.timeStamp) == false) {
88            return false;
89        }
90        return super.equals(obj);
91    }
92 
93    public boolean hasTimeStamp() {
94        if (this.timeStamp.isEmpty()) {
95            return false;
96        }
97        return true;
98    }
99 
100    public void readString(final String lineString, int offset) {
101        if (lineString == null) {
102            throw new NullPointerException("Image is null");
103        }
104        if ((offset < 0) || (offset >= lineString.length())) {
105            throw new IndexOutOfBoundsException("Offset to line is out of bounds: offset = " +
106                                                offset +
107                                                ", line.length()" +
108                                                lineString.length());
109        }
110        int delim;
111        ObjectLyrics3TimeStamp time;
112        this.timeStamp = new LinkedList();
113        delim = lineString.indexOf("[", offset);
114        while (delim >= 0) {
115            offset = lineString.indexOf("]", delim) + 1;
116            time = new ObjectLyrics3TimeStamp("Time Stamp");
117            time.readString(lineString.substring(delim, offset));
118            this.timeStamp.add(time);
119            delim = lineString.indexOf("[", offset);
120        }
121        this.lyric = lineString.substring(offset);
122    }
123 
124    public String toString() {
125        String str = "";
126        for (int i = 0; i < this.timeStamp.size(); i++) {
127            str += this.timeStamp.get(i).toString();
128        }
129        return "timeStamp = " + str + ", lyric = " + this.lyric + "\n";
130    }
131 
132    public String writeString() {
133        String str = "";
134        ObjectLyrics3TimeStamp time;
135        for (int i = 0; i < this.timeStamp.size(); i++) {
136            time = (ObjectLyrics3TimeStamp) this.timeStamp.get(i);
137            str += time.writeString();
138        }
139        return str + this.lyric;
140    }
141}

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