Formatted Chat file

Formatted Getters and Setters
This commit is contained in:
delvh 2019-10-19 10:14:46 +02:00 committed by GitHub
parent ce3d69c6b0
commit 4022e227ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,41 +18,23 @@ public class Chat {
messageList = new ArrayList<Message>(); messageList = new ArrayList<Message>();
} }
public void setUserID(long givenUserID) { public void setUserID(long givenUserID) { chatPartnerID = givenUserID;}
chatPartnerID = givenUserID;
}
public long getUserID() { public long getUserID() { return chatPartnerID;}
return chatPartnerID;
}
public int getSize() { public int getSize() { return chatModel.getSize();}
return chatModel.getSize();
}
public void addMessage(String message) { public void addMessage(String message) { chatModel.addElement(message);}
chatModel.addElement(message);
}
public String getMessageAt(int index) { public String getMessageAt(int index) { return (String) chatModel.getElementAt(index);}
return (String) chatModel.getElementAt(index);
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public DefaultListModel<String> getModel() { public DefaultListModel<String> getModel() { return chatModel;}
return chatModel;
}
public int getListSize() { public int getListSize() { return messageList.size();}
return messageList.size();
}
public void addMessageElement(Message message) { public void addMessageElement(Message message) { messageList.add(message);}
messageList.add(message);
}
public Message getMessageElement(int index) { public Message getMessageElement(int index) { return messageList.get(index);}
return messageList.get(index);
}
} }