/**
 * A very simple text document used in an example of the Command pattern
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class TextDocument
{
    private String      text;

    
    /**
     * Default Constructor
     */
    public TextDocument()
    {
	text = null;
    }



   /**
    * Get the text
    *
    * @return      The text
    */
    public String getText()
    {
	return text;
    }
 


    
    /**
     * Replace all occurences of one word with another
     *
     * @param oldWord   The old word
     * @param newWord   The new word
     */
    public void replace(String oldWord, String newWord)
    {
	text = text.replaceAll(oldWord, newWord);
    }



   /**
    * Set the text
    *
    * @param text      The text
    */
    public void setText(String text)
    {
	this.text = text;
    }
 
}
