/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.nplusc.izc.iZpl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 *
 * @author LH
 */
public class MultiPlayListItem implements PlayListItem
{
    private List<String> path,title;
    private int playcount,countPlayed;
    private String src;

    public MultiPlayListItem(){};
    
    
    public MultiPlayListItem(String[] path, String[] Title, int playcount)
    {
                            //arrays.asList()-lists=readonly :(
        this.path = new ArrayList<>(Arrays.asList(path));
        this.title = new ArrayList<>(Arrays.asList(Title));
        this.playcount = playcount;
        countPlayed=0; //noch nie gespielt als default; bei reload wird anderweitig verglichen :P
    }

    public List<String> getTitles()
    {
        return title;
    }
    public List<String> getPaths()
    {
        return path;
    }
    
    public void setTitles(List<String> p)
    {
        title=p;
    }
    
    public void setpaths(List<String> p)
    {
        path=p;
    }
    
    
    public void addTitle(String ppath,String ptitle)
    {
        path.add(ppath);
        title.add(ptitle);
    }
    
    public void removeElement(int i)
    {
        path.remove(i);
        title.remove(i);
    }
    
    
    public String getPath(int i)
    {
        return path.get(i);
    }

    
    public int getElemCount()
    {
        return path.size();
    }
   /* public void setPath(String path, int i)
    {
        this.
        this.path.add(i, path);
    }*/

    public String getTitle(int i)
    {
        return title.get(i);
    }

    /*public void setTitle(String Title, int i)
    {
        this.
        this.Title.add(i,Title);
    }*/

    public int getTargetPlaycount()
    {
        return playcount;
    }

    public void setTargetPlaycount(int playcount)
    {
        this.playcount = playcount;
    }

    public int getCountPlayed()
    {
        return countPlayed;
    }

    public void setCountPlayed(int countPlayed)
    {
        this.countPlayed = countPlayed;
    }
    
    public String getM3UElement()
    {
        String ret = "\n";
        for (int i = 0; i < path.size(); i++)
        {
            ret+=title.get(i)+"\n"+path.get(i)+"\n";
            
        }
        return ret.trim();
    }


    @Override
    public int hashCode()
    {
        int hash = 7;
        hash = 47 * hash + Objects.hashCode(this.path);
        hash = 47 * hash + Objects.hashCode(this.title);
        return hash;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null)
        {
            return false;
        }
        if (getClass() != obj.getClass())
        {
            return false;
        }
        final MultiPlayListItem other = (MultiPlayListItem) obj;
        if (!Objects.equals(this.path, other.path))
        {
            return false;
        }
        if (!Objects.equals(this.title, other.title))
        {
            return false;
        }
        return true;
    }

    public String getSrc()
    {
        return src;
    }

    public void setSrc(String src)
    {
        this.src = src;
    }
    
    
}
