package turgen.plugin.standard;

import turgen.Turgen;
import turgen.Utils;
import turgen.dtb.DOS2Binary;
import turgen.generator.PulseCrate;
import turgen.playlist.AbstractPlayListItem;
import turgen.plugin.BinaryConvertor;
import turgen.plugin.Plugin;


public class StandardMonolithicBinaryConvertor implements BinaryConvertor {

    private Plugin plugin;

    public StandardMonolithicBinaryConvertor(Plugin p) {
        this.plugin=p;
    }


    public boolean acceptsBinary(DOS2Binary bf) {
       return bf.isMonolithic();
    }

    public int getPilotToneCount(DOS2Binary bf) {
        return 1;
    }

    public String getDescription() {
        
        return "Standard - monolithic binary";
        
    }

    public boolean hasLoader() {
        return true;
    }

    public AbstractPlayListItem getPlaylistItem(DOS2Binary bf, String inFile, String outFile,PulseCrate speed) {


        int cd = bf.getDataSegmentCount();
        int cr = bf.getJumpSegmentCount();
        if (cd!=1) return null;

        StandardPlaylistItem spi = new StandardPlaylistItem(inFile,outFile,"",StandardPlaylistItem.IT_MONOLITHIC_BINARY,Utils.parseSilenceList(""),true);
        spi.pluginClass=Turgen.pluginManager.getPluginClassName(plugin);
        return spi;

    }

    public PulseCrate[] getSpeeds(int recorderModification) {
        return new PulseCrate[0];
    }

     public boolean acceptsRecorderModification(int recorderModification) {

        if (recorderModification==BinaryConvertor.REC_MOD_UN_STANDARD) return true;
        return false;


    }

    public boolean exhaustsRecorderModification(int recorderModification) {

        if (recorderModification==BinaryConvertor.REC_MOD_UN_STANDARD) return true;
        return false;
    }

    public boolean requiresPulses() {
        return false;
    }


}
