Package at.jku.ssw.fp.sect04_4.cmd_fp
Class TextEditor
- java.lang.Object
-
- at.jku.ssw.fp.sect04_4.cmd_fp.TextEditor
-
public class TextEditor extends Object
Simple class simulating actions of a text editor.- Author:
- Herbert Prähofer
-
-
Field Summary
Fields Modifier and Type Field Description private StringBuilder
text
-
Constructor Summary
Constructors Constructor Description TextEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addText(int pos, String textToAdd)
Adds a text at a given position.void
deleteText(int pos, int length)
Deletes a text at a given position.
-
-
-
Field Detail
-
text
private final StringBuilder text
-
-
Method Detail
-
addText
public void addText(int pos, String textToAdd)
Adds a text at a given position.- Parameters:
pos
- the positiontextToAdd
- the text to add
-
deleteText
public void deleteText(int pos, int length)
Deletes a text at a given position.- Parameters:
pos
- the positionlength
- the length of the text to delete
-
-