com.jscape.inet.terminal

## Class CommandSet

- java.lang.Object
- - com.jscape.inet.terminal.CommandSet

- Direct Known Subclasses:
    VT100Set, VT52Set

      public class CommandSet
      extends java.lang.Object

  Represents command set (ANSI, VT52) in terminal. "State" pattern [Gamma 94].

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommandSet(java.lang.String name)` Creates `CommandSet` object giving its name.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addCommand(java.lang.String sequence, ControlCommand command)` Add command as ControlCommand object to the internal command hash map.
    `ControlCommand` | `getCommand(java.lang.String sequence)` Get command as a `ControlCommand` object by its character sequence.
    `java.lang.String` | `getName()` Returns command set's name.
    `boolean` | `isControlChar(char ch)` Check if character passed is a control character.
    `boolean` | `removeCommand(java.lang.String sequence)` Remove command's ControlCommand object from internal command hash map.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CommandSet

          public CommandSet(java.lang.String name)

      Creates `CommandSet` object giving its name.
      Parameters:
        `name` - command set name.

  - ### Method Detail

    - #### isControlChar

          public boolean isControlChar(char ch)

      Check if character passed is a control character. Control codes: oct: 0, 5, 7, 10, 11, 12, 13, 14, 15, 16, 17, 21, 23, 30, 32, 33, 177 dec: 0, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 19, 24, 26, 27, 127
      Parameters:
        `ch` - character to check
      Returns:
        true if character is a control character, false otherwise

    - #### getCommand

          public ControlCommand getCommand(java.lang.String sequence)

      Get command as a `ControlCommand` object by its character sequence.
      Parameters:
        `sequence` - command sequence name.
      Returns:
        command obtained from hashmap as a `ControlCommand` object.

    - #### addCommand

          public boolean addCommand(java.lang.String sequence,
                                    ControlCommand command)

      Add command as ControlCommand object to the internal command hash map.
      Parameters:
        `sequence` - command char sequence to add.
        `command` - ControlCommand object for command.
      Returns:
        false if sequence already contained as a key in the map, otherwise true.

    - #### removeCommand

          public boolean removeCommand(java.lang.String sequence)

      Remove command's ControlCommand object from internal command hash map.
      Parameters:
        `sequence` - command sequence to remove.
      Returns:
        false if command hashmap does not contain sequence as a key, otherwise true.

    - #### getName

          public java.lang.String getName()

      Returns command set's name.
      Returns:
        command set's name.

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved