Kommentare

This commit is contained in:
BerdanInformatik123 2021-05-16 21:13:01 +02:00
parent 5167818835
commit ff07225d44

View file

@ -7,7 +7,7 @@ import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle; import java.time.format.FormatStyle;
import java.util.Date; import java.util.Date;
/** /**
* Die Klasse erzeugt die Message-Objekte * Die Klasse erzeugt die Message-Objekte
* @version 0.0.2 * @version 0.0.2
* @author berdan * @author berdan
@ -19,23 +19,25 @@ public class Message implements Serializable {
String username; String username;
String message; String message;
String time = "00:00"; String time = "00:00";
/*
LocalDateTime current = LocalDateTime.now(); /**
DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM); * Konstruktor des Message Objektes
String date = current.format(formatter); *
* @param username
* @param message
*
*/ */
public Message(String username, String message) { public Message(String username, String message) {
this.username = username; this.username = username;
this.message = message; this.message = message;
this.time = new SimpleDateFormat("HH.mm.ss").format(new Date()); this.time = new SimpleDateFormat("HH.mm.ss").format(new Date());
//this.date = date;
} }
/* /**
public String getMessage(){ * toString Methode
return this.message; * @return
}*/ */
@Override @Override
public String toString() { public String toString() {
return "nickname=" + username return "nickname=" + username
@ -44,25 +46,34 @@ public class Message implements Serializable {
//+ ", time=" + date; //+ ", time=" + date;
} }
/**
* Funktion gibt false aus, sobald der Text der Nachricht "exit" ist
* @return
*/
public boolean exit() { public boolean exit() {
if(message.equalsIgnoreCase("exit")){ return !message.equalsIgnoreCase("exit");
return false;
}
return true;
} }
/**
* Funktion, welche die Nachricht des Message Objektes zurück gibt
* @return
*/
public String getMessage() { public String getMessage() {
return message; return message;
} }
/**
* Funktion, welche den Usernamen des Message Objektes zurück gibt
* @return
*/
public String getUsername() { public String getUsername() {
return username; return username;
} }
/**
*
* @return
*/
public String getTime(){ public String getTime(){
return time; return time;
} }
} }