FileDocCategorySizeDatePackage
ID3v1Iterator.javaAPI DocJaudiotagger 2.0.45155Wed Mar 30 16:12:06 BST 2011org.jaudiotagger.tag.id3

ID3v1Iterator

public class ID3v1Iterator extends Object implements Iterator
author
: Paul Taylor
author
: Eric Farng Version @version:$Id: ID3v1Iterator.java 520 2008-01-01 15:16:38Z paultaylor $ MusicTag Copyright (C)2003,2004 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Description:

Fields Summary
private static final int
TITLE
private static final int
ARTIST
private static final int
ALBUM
private static final int
COMMENT
private static final int
YEAR
private static final int
GENRE
private static final int
TRACK
private ID3v1Tag
id3v1tag
private int
lastIndex
Constructors Summary
public ID3v1Iterator(ID3v1Tag id3v1tag)
Creates a new ID3v1Iterator datatype.

param
id3v1tag


                
      
    
        this.id3v1tag = id3v1tag;
    
Methods Summary
public booleanhasNext()

return

        return hasNext(lastIndex);
    
private booleanhasNext(int index)

param
index
return

        switch (index)
        {
            case TITLE:
                return (id3v1tag.title.length() > 0) || hasNext(index + 1);

            case ARTIST:
                return (id3v1tag.artist.length() > 0) || hasNext(index + 1);

            case ALBUM:
                return (id3v1tag.album.length() > 0) || hasNext(index + 1);

            case COMMENT:
                return (id3v1tag.comment.length() > 0) || hasNext(index + 1);

            case YEAR:
                return (id3v1tag.year.length() > 0) || hasNext(index + 1);

            case GENRE:
                return (id3v1tag.genre >= (byte) 0) || hasNext(index + 1);

            case TRACK:

                if (id3v1tag instanceof ID3v11Tag)
                {
                    return (((ID3v11Tag) id3v1tag).track >= (byte) 0) || hasNext(index + 1);
                }

            default:
                return false;
        }
    
public java.lang.Objectnext()

return

        return next(lastIndex);
    
private java.lang.Objectnext(int index)

param
index
return
throws
NoSuchElementException

        switch (lastIndex)
        {
            case 0:
                return (id3v1tag.title.length() > 0) ? id3v1tag.title : next(index + 1);

            case TITLE:
                return (id3v1tag.artist.length() > 0) ? id3v1tag.artist : next(index + 1);

            case ARTIST:
                return (id3v1tag.album.length() > 0) ? id3v1tag.album : next(index + 1);

            case ALBUM:
                return (id3v1tag.comment.length() > 0) ? id3v1tag.comment : next(index + 1);

            case COMMENT:
                return (id3v1tag.year.length() > 0) ? id3v1tag.year : next(index + 1);

            case YEAR:
                return (id3v1tag.genre >= (byte) 0) ? id3v1tag.genre : next(index + 1);

            case GENRE:
                return (id3v1tag instanceof ID3v11Tag && (((ID3v11Tag) id3v1tag).track >= (byte) 0)) ? ((ID3v11Tag) id3v1tag).track : null;

            default:
                throw new NoSuchElementException("Iteration has no more elements.");
        }
    
public voidremove()

        switch (lastIndex)
        {
            case TITLE:
                id3v1tag.title = "";

            case ARTIST:
                id3v1tag.artist = "";

            case ALBUM:
                id3v1tag.album = "";

            case COMMENT:
                id3v1tag.comment = "";

            case YEAR:
                id3v1tag.year = "";

            case GENRE:
                id3v1tag.genre = (byte) -1;

            case TRACK:

                if (id3v1tag instanceof ID3v11Tag)
                {
                    ((ID3v11Tag) id3v1tag).track = (byte) -1;
                }
        }