com.tffenterprises.music.tag.id3v2.frame
Class FractionFrame

java.lang.Object
  extended by com.tffenterprises.music.tag.id3v2.Frame
      extended by com.tffenterprises.music.tag.id3v2.frame.BaseFrame
          extended by com.tffenterprises.music.tag.id3v2.frame.TextBasedFrame
              extended by com.tffenterprises.music.tag.id3v2.frame.TextFrame
                  extended by com.tffenterprises.music.tag.id3v2.frame.FractionFrame
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
TrackFrame

public class FractionFrame
extends TextFrame
implements java.io.Serializable, java.lang.Cloneable

This class implements the TRCK frame type, which encodes the track number in an ID3v2 frame.

Version:
1.0d1 $Date: 2003/03/24 07:53:44 $
Author:
Guillamue Lessard
See Also:
Serialized Form

Field Summary
private  short item
          The item number.
private  short total
          The total number of items.
 
Fields inherited from class com.tffenterprises.music.tag.id3v2.frame.TextBasedFrame
BOM_CHAR, BOM_CHAR_STRING, ENCODING_STRINGS, ISO_8859_1, NULL_BOM_STRING, NULL_CHAR, NULL_CHAR_STRING, UNICODE, UNICODE_BIG, UNICODE_LITTLE, UTF8
 
Constructor Summary
FractionFrame()
          Constructs a new TextFrame with no data, and no valid frame type.
FractionFrame(FrameHeader header)
          Constructs a new FractionFrame with the specified frame header and no data.
FractionFrame(FrameHeader header, short item, short total)
          Constructs a new TextFrame with the specified frame header and text.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this ID3v2 frame.
 boolean equals(java.lang.Object other)
          Compares this ID3v2 frame with another object.
 short getItem()
          Returns the item number.
 java.lang.String getPartName()
          Returns the name of the part of a whole represented by this frame type.
 java.lang.String getText()
          Returns the text contained in this frame.
 short getTotal()
          Returns the total number of items.
private  void sanitize()
          Fixes any numbers that don't make sense, and synchronizes the string in the parent class with our numbers.
 void setItem(short i)
          Set the item number.
 void setText(java.lang.String frameText)
          Sets the text contained in this frame.
 void setTotal(short t)
          Set the total number of items.
 java.lang.String toString()
          Returns a String representation of this frame.
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.frame.TextFrame
getRawData, isOfRepeatableType, setRawData
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.frame.TextBasedFrame
getNullBytes, getTextEncoding, getTextEncoding, getTextEncoding, is8859String, read8859Characters, read8859String, readCharacters, readString, readUnicodeCharacters, readUnicodeString
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.frame.BaseFrame
getBytes, getChecksum, getFormatFlags, getFrameID, getHeader, getStatusFlags, hashCode, isChanged, setChanged, setFormatFlags, setStatusFlags, toByteArray, updateChecksum, writeTo
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.Frame
FromByteArray, FromByteArray, FromInputStream, GetFrameClassForID, getNewInstance, getNewInstance, getNewInstance, MinimumLength, RegisterFrameClass, UnregisterFrameClass
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

item

private short item
The item number.


total

private short total
The total number of items.

Constructor Detail

FractionFrame

public FractionFrame()
Constructs a new TextFrame with no data, and no valid frame type.


FractionFrame

public FractionFrame(FrameHeader header)
Constructs a new FractionFrame with the specified frame header and no data.

Parameters:
header - The FrameHeader instance to be used for this TextFrame.
Throws:
java.lang.IllegalArgumentException - if the specified frame data is null.

FractionFrame

public FractionFrame(FrameHeader header,
                     short item,
                     short total)
              throws java.lang.IllegalArgumentException
Constructs a new TextFrame with the specified frame header and text.

Parameters:
header - The FrameHeader instance to be used for this TextFrame.
item - The item number.
total - The total number of items.
Throws:
java.lang.IllegalArgumentException - if the specified frame data is null.
Method Detail

clone

public java.lang.Object clone()
Returns a clone of this ID3v2 frame.

Overrides:
clone in class TextFrame
Returns:
a clone of this ID3v2 frame.

equals

public boolean equals(java.lang.Object other)
Compares this ID3v2 frame with another object.

Overrides:
equals in class TextFrame
Parameters:
other - The other object.
Returns:
true if the two objects are equivalent, false otherwise.

toString

public java.lang.String toString()
Returns a String representation of this frame.

Overrides:
toString in class TextFrame
Returns:
a String representation of this frame.

getText

public java.lang.String getText()
Returns the text contained in this frame.

Overrides:
getText in class TextFrame
Returns:
the text contained in this frame.

setText

public void setText(java.lang.String frameText)
Sets the text contained in this frame.

Overrides:
setText in class TextFrame
Parameters:
frameText - The text.
Throws:
java.lang.IllegalArgumentException - if the text is null.

getItem

public short getItem()
Returns the item number.

Returns:
the item number.

setItem

public void setItem(short i)
Set the item number.

Parameters:
i - the new item number.

getTotal

public short getTotal()
Returns the total number of items.

Returns:
the total number of items.

setTotal

public void setTotal(short t)
Set the total number of items.

Parameters:
t - the new total of items.

sanitize

private void sanitize()
Fixes any numbers that don't make sense, and synchronizes the string in the parent class with our numbers. This may not make sense by itself anyway.


getPartName

public java.lang.String getPartName()
Returns the name of the part of a whole represented by this frame type.

Returns:
the name of the part of a whole represented by this frame type.