package com.github.bot.curiosone.core.workflow;

import java.util.Objects;

public class Message {
  /** The message. */
  String message;

  /** The scope. */
  String scope;

  /**
   * Constructor of a Message.
   * @param msg the message
   * @param scope the scope
   */
  public Message(String msg, String scope) {
    if (msg == null) {
      msg = "";
    }
    if (scope == null) {
      scope = "";
    }
    this.message = msg;
    this.scope = scope;
  }

  /**
   * Gets the message.
   * @return the message.
   */
  public String getMessage() {
    return message;
  }

  /**
   * Gets the scope.
   * @return the scope.
   */
  public String getScope() {
    return scope;
  }

  /**
   * Returns a string representation of this message.
   *
   * @return a string representation of this message.
   */
  @Override
  public String toString() {
    return message + " (" + scope + ")";
  }

  /**
   * Compares this message to the specified object.
   *
   * @param  other the other message
   * @return {@code true} if this message equals the other message;
   *         {@code false} otherwise
   */
  @Override
  public boolean equals(Object other) {
    if (other == this) {
      return true;
    }
    if (other == null || other.getClass() != this.getClass()) {
      return false;
    }
    Message that = (Message) other;
    return this.message.equals(that.message) && this.scope.equals(that.scope);
  }

  /**
   * Returns an integer hash code for this message.
   *
   * @return an integer hash code for this message
   */
  @Override
  public int hashCode() {
    return Objects.hash(message, scope);
  }
}

@@ -69,16 +69,241 @@
 jects;%0A%0A
+/**%0A * Manages a Message.%0A * A Message consists of two String: one to store the content of the Message and the other one to%0A * store its scope.%0A * Provides all the utility methods to create, access and compare a Message.%0A */%0A
 public c
@@ -321,26 +321,58 @@
 e %7B%0A
+%0A
   /**
- The m
+%0A   * Stores the content of this M
 essage.
+%0A  
  */%0A
@@ -399,19 +399,50 @@
  /**
- The scope.
+%0A   * Stores the scope of this Message.%0A  
  */%0A
@@ -482,23 +482,22 @@
 ruct
-or of a
+s this
  Message
 .%0A  
@@ -488,24 +488,58 @@
 this Message
+ from a text/content and its scope
 .%0A   * @para
@@ -544,27 +544,45 @@
 ram msg 
-the m
+M
 essage
+ content. Can be null.
 %0A   * @p
@@ -592,25 +592,43 @@
 m scope 
-th
+Messag
 e scope
+. Can be null.
 %0A   */%0A 
@@ -675,18 +675,25 @@
 ) %7B%0A    
-if
+message =
  (msg ==
@@ -703,121 +703,59 @@
 ll) 
-%7B%0A      msg = %22%22;%0A    %7D%0A    if (scope == null) %7B%0A      scope = %22%22;%0A    %7D%0A    this.message = msg;%0A    this.scope =
+? %22%22 : msg;%0A    this.scope = (scope == null) ? %22%22 :
  sco
@@ -787,35 +787,25 @@
 the 
-message.%0A   * @return the m
+content of this M
 essa
@@ -899,31 +899,23 @@
 cope
-.%0A   * @return the scop
+ of this Messag
 e.%0A 
@@ -992,17 +992,17 @@
 turns a 
-s
+S
 tring re
@@ -1026,68 +1026,9 @@
 his 
-message.%0A   *%0A   * @return a string representation of this m
+M
 essa
@@ -1140,59 +1140,63 @@
  * C
-ompares
+hecks whether
  this 
-m
+M
 essage 
-to the specified o
+equals to the given O
 bject.%0A
-   *%0A
    *
@@ -1220,23 +1220,47 @@
 e other 
-m
+M
 essage
+ to be compared against.
 %0A   * @r
@@ -1282,25 +1282,25 @@
 ue%7D if this 
-m
+M
 essage equal
@@ -1311,17 +1311,17 @@
 e other 
-m
+M
 essage;%0A
@@ -1698,39 +1698,30 @@
 rns 
-an integer hash c
+the HashC
 ode 
+o
 f
-or
  this 
-m
+M
 essa
@@ -1732,59 +1732,85 @@
    *
-%0A   * @return an integer hash code for this message
+ The HashCode is based on the HashCodes of the Message content and its scope.
 %0A   

improve Message javadoc