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

COVERAGE SUMMARY FOR SOURCE FILE [ObjectLyrics3Image.java]

nameclass, %method, %block, %line, %
ObjectLyrics3Image.java100% (1/1)85%  (11/13)71%  (222/313)81%  (52.9/65)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ObjectLyrics3Image100% (1/1)85%  (11/13)71%  (222/313)81%  (52.9/65)
ObjectLyrics3Image (ObjectLyrics3Image): void 0%   (0/1)0%   (0/34)0%   (0/8)
toString (): String 0%   (0/1)0%   (0/40)0%   (0/4)
readString (String, int): void 100% (1/1)78%  (62/79)93%  (14/15)
ObjectLyrics3Image (String): void 100% (1/1)100% (15/15)100% (6/6)
equals (Object): boolean 100% (1/1)100% (44/44)100% (13/13)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getFilename (): String 100% (1/1)100% (3/3)100% (1/1)
getSize (): int 100% (1/1)100% (23/23)100% (4/4)
getTimeStamp (): ObjectLyrics3TimeStamp 100% (1/1)100% (3/3)100% (1/1)
setDescription (String): void 100% (1/1)100% (4/4)100% (2/2)
setFilename (String): void 100% (1/1)100% (4/4)100% (2/2)
setTimeStamp (ObjectLyrics3TimeStamp): void 100% (1/1)100% (4/4)100% (2/2)
writeString (): String 100% (1/1)100% (57/57)100% (9/9)

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

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