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.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
*/ */
public class Message implements Serializable { public class Message implements Serializable {
@ -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;
} }
public boolean exit() { /**
if(message.equalsIgnoreCase("exit")){ * Funktion gibt false aus, sobald der Text der Nachricht "exit" ist
return false; * @return
} */
return true; public boolean exit() {
} return !message.equalsIgnoreCase("exit");
}
public String getMessage() {
return message; /**
} * Funktion, welche die Nachricht des Message Objektes zurück gibt
* @return
public String getUsername() { */
return username; public String getMessage() {
} return message;
}
public String getTime(){ /**
return time; * Funktion, welche den Usernamen des Message Objektes zurück gibt
} * @return
*/
public String getUsername() {
return username;
}
/**
*
* @return
*/
public String getTime(){
return time;
}
} }