Coverage Report - org.jaudiotagger.tag.datatype.BooleanString
 
Classes in this File Line Coverage Branch Coverage Complexity
BooleanString
0%
0/19
0%
0/8
1.571
 
 1  
 /**
 2  
  *  @author : Paul Taylor
 3  
  *  @author : Eric Farng
 4  
  *
 5  
  *  Version @version:$Id: BooleanString.java,v 1.8 2008/07/21 10:45:41 paultaylor Exp $
 6  
  *
 7  
  *  MusicTag Copyright (C)2003,2004
 8  
  *
 9  
  *  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
 10  
  *  General Public  License as published by the Free Software Foundation; either version 2.1 of the License,
 11  
  *  or (at your option) any later version.
 12  
  *
 13  
  *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 14  
  *  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 15  
  *  See the GNU Lesser General Public License for more details.
 16  
  *
 17  
  *  You should have received a copy of the GNU Lesser General Public License along with this library; if not,
 18  
  *  you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
 19  
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 20  
  *
 21  
  * Description:
 22  
  *
 23  
  */
 24  
 package org.jaudiotagger.tag.datatype;
 25  
 
 26  
 import org.jaudiotagger.tag.InvalidDataTypeException;
 27  
 import org.jaudiotagger.tag.id3.AbstractTagFrameBody;
 28  
 
 29  
 public class BooleanString extends AbstractDataType
 30  
 {
 31  
     /**
 32  
      * Creates a new ObjectBooleanString datatype.
 33  
      *
 34  
      * @param identifier
 35  
      */
 36  
     public BooleanString(String identifier, AbstractTagFrameBody frameBody)
 37  
     {
 38  0
         super(identifier, frameBody);
 39  0
     }
 40  
 
 41  
     public BooleanString(BooleanString object)
 42  
     {
 43  0
         super(object);
 44  0
     }
 45  
 
 46  
     /**
 47  
      * @return
 48  
      */
 49  
     public int getSize()
 50  
     {
 51  0
         return 1;
 52  
     }
 53  
 
 54  
     public boolean equals(Object obj)
 55  
     {
 56  0
         if (obj instanceof BooleanString == false)
 57  
         {
 58  0
             return false;
 59  
         }
 60  
 
 61  0
         return super.equals(obj);
 62  
     }
 63  
 
 64  
     /**
 65  
      * @param offset
 66  
      * @throws NullPointerException
 67  
      * @throws IndexOutOfBoundsException
 68  
      */
 69  
     public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
 70  
     {
 71  0
         byte b = arr[offset];
 72  0
         value = b != '0';
 73  0
     }
 74  
 
 75  
     /**
 76  
      * @return
 77  
      */
 78  
     public String toString()
 79  
     {
 80  0
         return "" + value;
 81  
     }
 82  
 
 83  
     /**
 84  
      * @return
 85  
      */
 86  
     public byte[] writeByteArray()
 87  
     {
 88  0
         byte[] booleanValue = new byte[1];
 89  0
         if (value == null)
 90  
         {
 91  0
             booleanValue[0] = '0';
 92  
         }
 93  
         else
 94  
         {
 95  0
             if ((Boolean) value == true)
 96  
             {
 97  0
                 booleanValue[0] = '0';
 98  
             }
 99  
             else
 100  
             {
 101  0
                 booleanValue[0] = '1';
 102  
             }
 103  
         }
 104  0
         return booleanValue;
 105  
     }
 106  
 }