package turgen.plugin.btape;

import turgen.generator.PulseCrate;
import turgen.plugin.SimplePlaylistItem;
import turgen.plugin.*;


public class BTapePlayListItem extends SimplePlaylistItem {
    
    boolean longGaps;
    boolean doubleBlocks;
    int loader;
    
    public BTapePlayListItem() {
        
    }
    
    public BTapePlayListItem(String inF,String outF,PulseCrate speed,String fname,int[] pauses,boolean longGaps,boolean doubleBlocks,int loader) {
        this.inFile=inF;
        this.outFile=outF;
        this.pulses=speed;
        this.pauses=pauses;
        this.fname=fname;
        this.longGaps=longGaps;
        this.doubleBlocks=doubleBlocks;
        this.loader=loader;
        
    }
    
    public String toString() {
        String ldr=" +BL";
        char[] mode = new char[2];
        mode[0]='S';
        mode[1]='S';

        if (longGaps==true) mode[0]='L';
        if (doubleBlocks==true) mode[1]='D';
        if (loader==BTapePlugin.BL_NONE) ldr="";
        
        return fname+" ["+new String(mode)+"]"+ldr;
    }
    
    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.pauses==null) pauses=new int[0];
        if (this.loader<0 || this.loader>BTapePlugin.BL_NANOBTAPE_UR) this.loader=BTapePlugin.BL_NONE;
        return true;
    }

}
