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

COVERAGE SUMMARY FOR SOURCE FILE [ObjectBooleanByte.java]

nameclass, %method, %block, %line, %
ObjectBooleanByte.java100% (1/1)62%  (5/8)78%  (124/160)80%  (26.4/33)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ObjectBooleanByte100% (1/1)62%  (5/8)78%  (124/160)80%  (26.4/33)
ObjectBooleanByte (ObjectBooleanByte): void 0%   (0/1)0%   (0/11)0%   (0/4)
getBitPosition (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/10)0%   (0/1)
ObjectBooleanByte (String, int): void 100% (1/1)59%  (17/29)86%  (6/7)
equals (Object): boolean 100% (1/1)100% (19/19)100% (6/6)
getSize (): int 100% (1/1)100% (2/2)100% (1/1)
readByteArray (byte [], int): void 100% (1/1)100% (57/57)100% (9/9)
writeByteArray (): byte [] 100% (1/1)100% (29/29)100% (5/5)

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 ObjectBooleanByte extends AbstractMP3Object {
11 
12    int bitPosition = -1;
13 
14    /**
15     * Creates a new ObjectBooleanByte object.
16     */
17    public ObjectBooleanByte(final String identifier, final int bitPosition) {
18        if ((bitPosition < 0) || (bitPosition > 7)) {
19            throw new IndexOutOfBoundsException("Bit position needs to be from 0 - 7 : " + bitPosition);
20        }
21        this.bitPosition = bitPosition;
22        this.identifier = identifier;
23    }
24 
25    /**
26     * Creates a new ObjectBooleanByte object.
27     */
28    public ObjectBooleanByte(final ObjectBooleanByte copyObject) {
29        super(copyObject);
30        this.bitPosition = copyObject.bitPosition;
31    }
32 
33    public int getBitPosition() {
34        return this.bitPosition;
35    }
36 
37    public int getSize() {
38        return 1;
39    }
40 
41    public boolean equals(final Object obj) {
42        if ((obj instanceof ObjectBooleanByte) == false) {
43            return false;
44        }
45        final ObjectBooleanByte objectBooleanByte = (ObjectBooleanByte) obj;
46        if (this.bitPosition != objectBooleanByte.bitPosition) {
47            return false;
48        }
49        return super.equals(obj);
50    }
51 
52    public void readByteArray(final byte[] arr, final int offset) {
53        if (arr == null) {
54            throw new NullPointerException("Byte array is null");
55        }
56        if ((offset < 0) || (offset >= arr.length)) {
57            throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " +
58                                                offset +
59                                                ", array.length = " +
60                                                arr
61                                                        .length);
62        }
63        byte newValue = arr[offset];
64        newValue >>= this.bitPosition;
65        newValue &= 0x1;
66        this.value = new Boolean(newValue == 1);
67    }
68 
69    public String toString() {
70        return "" + this.value;
71    }
72 
73    public byte[] writeByteArray() {
74        final byte[] retValue;
75        retValue = new byte[1];
76        if (this.value != null) {
77            retValue[0] = (byte) (((Boolean) this.value).booleanValue() ? 1 : 0);
78            retValue[0] <<= this.bitPosition;
79        }
80        return retValue;
81    }
82}

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