package CH.ifa.draw.io.exportFormats;

import de.renew.draw.ui.ontology.AbstractCommand;

/**
 * Abstract implementation of Command to be executed on ExportFormat.
 * @deprecated This class is not to be used anymore and will later be removed.
 */
@Deprecated(since = "5.0", forRemoval = true)
@SuppressWarnings("removal")
public abstract class ExportFormatCommand extends AbstractCommand {
    // Attributes
    // The ImportFormat
    private ExportFormat _format;

    /**
     * Constructs ExportFormatCommand with the ExportFormat to be executed on and an appendix
     * that together with the format name forms the command name.
     *
     * @param format The export format the command is executed on
     * @param append The appendix to be placed after format name
     * */
    public ExportFormatCommand(ExportFormat format, String append) {
        super(format.formatName() + append);
        setFormat(format);
    }

    // Methods


    /**
     * Returns the FormatId.
     * @ensure result != null
     * @return FormatId the formatId
     */
    public ExportFormat format() {
        ExportFormat result;
        result = _format;
        assert (result != null) : "Failure in GuiPlugin.FormatCommand: result == null";
        return result;
    }

    /**
     * Sets _formatId to formatId.
     * @ensure formatId() != null
     * @param format the value to be set
     */
    private void setFormat(ExportFormat format) {
        _format = format;
        assert (format() != null) : "Failure in GuiPlugin.FormatCommand: formatId() == null";
    }

    @Override
    public abstract boolean isExecutable();
}