package com.jscape.inet.terminal.commands;

import com.jscape.inet.terminal.Terminal;
import com.jscape.inet.terminal.USAscii;

/**
 * SCS -- Select Character Set.
 * Sets US ASCII character set to register G1.
 */
public class SCSG1BCommand
        implements ControlCommand {

    public static final String CANONICAL_FORM = "\033)B";
    private static final SCSG1BCommand INSTANCE = new SCSG1BCommand();

    //----------------------------------------------------------------------------

    /**
     * Returns one and only one instance of this type.
     *
     * @return one and only one instance of this type.
     */
    public static SCSG1BCommand getInstance() {
        return INSTANCE;
    }

    //----------------------------------------------------------------------------

    /**
     * Private constructor to prevent uncontrolled creation.
     */
    private SCSG1BCommand() {
    }

    //----------------------------------------------------------------------------

    /**
     * Executes command giving parameters and <code>Terminal</code> object.
     *
     * @param params   array of <code>int</code> command parametrs.
     * @param terminal target <code>Terminal</code> object.
     */
    public void execute(int[] params, Terminal terminal) {
        terminal.setG1(USAscii.getInstance());
    }

    //----------------------------------------------------------------------------

    /**
     * Sends command to remote host.
     *
     * @param params   command parameters.
     * @param terminal target <code>Terminal</code> object to send command.
     */
    public void send(int[] params, Terminal terminal) {
        terminal.send(CANONICAL_FORM);
    }

}
