Class ChatMessage

  • All Implemented Interfaces:
    IMessage

    public class ChatMessage
    extends java.lang.Object
    implements IMessage
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      ChatMessage​(java.lang.String buffer)
      Constructor of the class
      ChatMessage​(java.lang.String from, java.lang.String info)
      Constructor of the class
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getFrom()
      "getter" for where the message comes from
      java.lang.String getInfo()
      "getter" for the info of the message
      Command getType()
      "getter" for the type of the command
      void setFrom​(java.lang.String from)
      "setter" for where the message comes from
      java.lang.String toString()
      the to String method, forms the message into a string, seperated by "|"
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ChatMessage

        public ChatMessage​(java.lang.String buffer)
        Constructor of the class
        Parameters:
        buffer - string which splits
      • ChatMessage

        public ChatMessage​(java.lang.String from,
                           java.lang.String info)
        Constructor of the class
        Parameters:
        from - where the message comes from
        info - info of the message
    • Method Detail

      • getInfo

        public java.lang.String getInfo()
        "getter" for the info of the message
        Returns:
        info of the message
      • getFrom

        public java.lang.String getFrom()
        "getter" for where the message comes from
        Returns:
        where the messages come from
      • setFrom

        public void setFrom​(java.lang.String from)
        "setter" for where the message comes from
        Parameters:
        from - where the message comes from
      • toString

        public java.lang.String toString()
        the to String method, forms the message into a string, seperated by "|"
        Overrides:
        toString in class java.lang.Object
        Returns:
        string which contains the command type, the sender and the message info seperated by a "|"
      • getType

        public Command getType()
        "getter" for the type of the command
        Specified by:
        getType in interface IMessage
        Returns:
        type of the command