package turgen.plugin.kblock;
import turgen.generator.PulseCrate;
import turgen.playlist.AbstractPlayListItem;
import turgen.plugin.*;


public class KBlockPlayListItem extends SimplePlaylistItem {

    public KBlockPlayListItem() {
        
    }

    public KBlockPlayListItem(String inF,String outF,PulseCrate speed,String fname,int[] sList,int loader) {
        this.inFile=inF;
        this.outFile=outF;
        this.pulses=speed;
        this.silenceList=sList;
        this.fname=fname;
        this.loader=loader;

    }

    public String toString() {

        String ldr="BL + ";
        if (loader==KBlockPlugin.BL_NONE) ldr="";

        return ldr+fname;
    }

    public boolean validate() {
        if (this.inFile==null) return false;
        if (this.outFile==null) this.outFile="";
        if (this.fname==null) this.fname="NONAME";
        if (this.pulses==null) return false;
        if (this.silenceList==null) silenceList=new int[0];
        if (this.loader<0 || this.loader>KBlockPlugin.BL_NANOTBL_UR) this.loader=KBlockPlugin.BL_NONE;
        return true;
    }
    
    public AbstractPlayListItem getClonedCopy() {
        int[] silenceListCopy = (int[])this.silenceList.clone();
        PulseCrate pulsesCopy = pulses.getCopy();
        KBlockPlayListItem item = new KBlockPlayListItem(inFile, outFile, pulsesCopy,fname, silenceListCopy,loader);
        copyBasics(item);
        return item;
    }
}
