Coverage Report - org.jaudiotagger.tag.id3.AbstractTagFrame
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractTagFrame
26%
6/23
0%
0/22
3.333
 
 1  
 /**
 2  
  *  @author : Paul Taylor
 3  
  *  @author : Eric Farng
 4  
  *
 5  
  *  Version @version:$Id: AbstractTagFrame.java 836 2009-11-12 15:44:07Z paultaylor $
 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  
  * This class represents 'parts of tags'. It contains methods that they all use
 23  
  * use. ID3v2 tags have frames. Lyrics3 tags have fields. ID3v1 tags do not
 24  
  * have parts. It also contains their header while the body contains the
 25  
  * actual fragments.
 26  
  */
 27  
 package org.jaudiotagger.tag.id3;
 28  
 
 29  
 /**
 30  
  * A frame contains meta-information of a particular type. A frame contains a header and a body
 31  
  */
 32  
 public abstract class AbstractTagFrame extends AbstractTagItem
 33  
 {
 34  
 
 35  
     /**
 36  
      * Actual data this fragment holds
 37  
      */
 38  
     protected AbstractTagFrameBody frameBody;
 39  
 
 40  
     public AbstractTagFrame()
 41  15556
     {
 42  15556
     }
 43  
 
 44  
     /**
 45  
      * This constructs the bodies copy constructor this in turn invokes
 46  
      * * bodies objectlist.
 47  
      * @param copyObject
 48  
      */
 49  
     public AbstractTagFrame(AbstractTagFrame copyObject)
 50  0
     {
 51  0
         this.frameBody = (AbstractTagFrameBody) ID3Tags.copyObject(copyObject.frameBody);
 52  0
         this.frameBody.setHeader(this);
 53  0
     }
 54  
 
 55  
     /**
 56  
      * Sets the body datatype for this fragment. The body datatype contains the
 57  
      * actual information for the fragment.
 58  
      *
 59  
      * @param frameBody the body datatype
 60  
      */
 61  
     public void setBody(AbstractTagFrameBody frameBody)
 62  
     {
 63  676
         this.frameBody = frameBody;
 64  676
         this.frameBody.setHeader(this);
 65  676
     }
 66  
 
 67  
     /**
 68  
      * Returns the body datatype for this fragment. The body datatype contains the
 69  
      * actual information for the fragment.
 70  
      *
 71  
      * @return the body datatype
 72  
      */
 73  
     public AbstractTagFrameBody getBody()
 74  
     {
 75  22096
         return this.frameBody;
 76  
     }
 77  
 
 78  
     /**
 79  
      * Returns true if this datatype and it's body is a subset of the argument.
 80  
      * This datatype is a subset if the argument is the same class.
 81  
      *
 82  
      * @param obj datatype to determine if subset of
 83  
      * @return true if this datatype and it's body is a subset of the argument.
 84  
      */
 85  
     public boolean isSubsetOf(Object obj)
 86  
     {
 87  0
         if (!(obj instanceof AbstractTagFrame))
 88  
         {
 89  0
             return false;
 90  
         }
 91  
 
 92  0
         if ((frameBody == null) && (((AbstractTagFrame) obj).frameBody == null))
 93  
         {
 94  0
             return true;
 95  
         }
 96  
 
 97  0
         if ((frameBody == null) || (((AbstractTagFrame) obj).frameBody == null))
 98  
         {
 99  0
             return false;
 100  
         }
 101  
 
 102  0
         return frameBody.isSubsetOf(((AbstractTagFrame) obj).frameBody) && super.isSubsetOf(obj);
 103  
 
 104  
     }
 105  
 
 106  
     /**
 107  
      * Returns true if this datatype and its body equals the argument and its
 108  
      * body. this datatype is equal if and only if they are the same class and
 109  
      * have the same <code>getSubId</code> id string.
 110  
      *
 111  
      * @param obj datatype to determine equality of
 112  
      * @return true if this datatype and its body equals the argument and its
 113  
      *         body.
 114  
      */
 115  
     public boolean equals(Object obj)
 116  
     {
 117  0
         if (!(obj instanceof AbstractTagFrame))
 118  
         {
 119  0
             return false;
 120  
         }
 121  
 
 122  0
         AbstractTagFrame object = (AbstractTagFrame) obj;
 123  
 
 124  0
         if (!this.getIdentifier().equals(object.getIdentifier()))
 125  
         {
 126  0
             return false;
 127  
         }
 128  
 
 129  0
         return this.frameBody.equals(object.frameBody) && super.equals(obj);
 130  
 
 131  
     }
 132  
 }