Class TextMessage

java.lang.Object
  extended by TextMessage

public class TextMessage
extends java.lang.Object

TextMessage - a class for a text message. Used by, for example, PhoneKeypad (do not delete).

Author:
Scott MacKenzie, 2008
See Also:
source code

Method Summary
 void addWord(java.lang.String s)
          Add word to end of text message.
 void appendCharacter(char c)
          Appends a character to the last word in the text message.
 void clear()
          Clear the text message.
 int getCharacter(int i)
          Returns the character at position i.
 java.lang.String getCodedMessage()
          Returns message as series of codes (as per phone keypad).
 java.lang.String getMessage()
          Returns the text message as a string.
 int getSize()
          Returns the size of the text message, in characters.
 int getWordCount()
          Returns the number of words in the text message.
static void main(java.lang.String[] args)
          Test the TextMessage class.
 void printMessage()
          Print the text message on the console.
 void replaceLast(java.lang.String s)
          Replace last word in message with passed word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMessage

public java.lang.String getMessage()
Returns the text message as a string.


getSize

public int getSize()
Returns the size of the text message, in characters.


getWordCount

public int getWordCount()
Returns the number of words in the text message.


getCharacter

public int getCharacter(int i)
Returns the character at position i.


getCodedMessage

public java.lang.String getCodedMessage()
Returns message as series of codes (as per phone keypad).


addWord

public void addWord(java.lang.String s)
Add word to end of text message.


replaceLast

public void replaceLast(java.lang.String s)
Replace last word in message with passed word. If no message, add passed word.


appendCharacter

public void appendCharacter(char c)
Appends a character to the last word in the text message.


clear

public void clear()
Clear the text message.


printMessage

public void printMessage()
Print the text message on the console.


main

public static void main(java.lang.String[] args)
Test the TextMessage class.