This repository has been archived on 2022-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
geiserpbot/src/elements/ChatListItem.java
vylion ef2ea921cc Added some save functionality in Persistence layer.
Added some finishing touches to the Message classes.
Integrated some event support in input handling.
2016-10-09 16:34:36 +02:00

40 lines
897 B
Java

package elements;
import elements.exceptions.ReadErrorListException;
/**
* Created by Guillermo Serrahima on 10/9/16.
*/
public class ChatListItem {
private String name;
private Integer value;
private ChatListItem() {
}
public ChatListItem(String name, int value) {
this.name = name;
this.value = value;
}
public ChatListItem(String parse) throws ReadErrorListException {
String[] reading = parse.split(";");
if(reading.length > 2) throw new ReadErrorListException("Unidentified item.");
this.name = reading[0];
this.value = Integer.parseInt(reading[1]);
}
public int compareTo(ChatListItem c) {
return name.compareTo(c.name);
}
@Override
public String toString() {
return name + ": " + value;
}
public String saveItem() {
return name + ";" + value;
}
}