Kommentare

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

View file

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