Class OpenMessage

Object
OpenMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
CaesarMessage, SubstitutionMessage

public class OpenMessage extends Object implements Message
  • Field Details

  • Constructor Details

  • Method Details

    • getBody

      public String getBody()
      Gets the body of the message
      Specified by:
      getBody in interface Message
      Returns:
      String body
    • getTo

      public String getTo()
      Gets the "to" portion of the message
      Specified by:
      getTo in interface Message
      Returns:
      String to
    • getSubject

      public String getSubject()
      Gets the subject of the message
      Specified by:
      getSubject in interface Message
      Returns:
      String subject
    • getFrom

      public String getFrom()
      Gets the "from" portion of the message
      Specified by:
      getFrom in interface Message
      Returns:
      String from
    • search

      public boolean search(String term, String part)
      Searches for a particular term in a part of the message. Implemented in Lab 10.
      Specified by:
      search in interface Message
      Parameters:
      term - String term to check
      part - Portion of OpenMessage to check in
      Returns:
      boolean value of the term being in the part (not worrying about case)
    • searchSubject

      public boolean searchSubject(String term)
      Searches for a message by subject. Implemented in Lab 10.
      Specified by:
      searchSubject in interface Message
      Parameters:
      term - term used to see if contained in subject
      Returns:
      boolean result if term was in the subject
    • searchTo

      public boolean searchTo(String term)
      Searches for a message by "to" portion of the message. Implemented in Lab 10.
      Specified by:
      searchTo in interface Message
      Parameters:
      term - term used to see if contained in "to" portion
      Returns:
      boolean result if term was in the "to" portion
    • searchFrom

      public boolean searchFrom(String term)
      Searches for a message by "from" portion of the message. Implemented in Lab 10.
      Specified by:
      searchFrom in interface Message
      Parameters:
      term - term used to see if contained in "from" portion
      Returns:
      boolean result if term was in the "from" portion
    • toString

      public String toString()
      Creates and returns a String that represents our OpenMessage object. Implemented in Lab 12, make sure toString() returns a newline character "\n" at the end of the message (after the body).
      Overrides:
      toString in class Object
      Returns:
      String message