Class AddTextCommand

  • All Implemented Interfaces:
    Command

    public class AddTextCommand
    extends Object
    implements Command
    Command to add a text.
    Author:
    Herbert Prähofer
    • Field Detail

      • text

        private final StringBuilder text
        The string builder where the text is added.
      • pos

        private final int pos
        The position where the text is added.
      • textToAdd

        private final String textToAdd
        The text to add.
    • Constructor Detail

      • AddTextCommand

        public AddTextCommand​(StringBuilder text,
                              int pos,
                              String textToAdd)
        Constructor setting string builder, position and text.
        Parameters:
        text - The string builder where the text should be added
        pos - The position where the text should be added
        textToAdd - The text to add
    • Method Detail

      • doCmd

        public void doCmd()
        Executes the command.
        Specified by:
        doCmd in interface Command
      • undoCmd

        public void undoCmd()
        Undoes the command.
        Specified by:
        undoCmd in interface Command