1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/wsdor/src/main/java/cz/xelfi/quoridor/webidor/Note.java Sat Sep 11 17:04:51 2010 +0200
1.3 @@ -0,0 +1,79 @@
1.4 +package cz.xelfi.quoridor.webidor;
1.5 +
1.6 +import java.util.Date;
1.7 +import javax.xml.bind.annotation.XmlAccessType;
1.8 +import javax.xml.bind.annotation.XmlAccessorType;
1.9 +import javax.xml.bind.annotation.XmlAttribute;
1.10 +import javax.xml.bind.annotation.XmlValue;
1.11 +
1.12 +/**
1.13 + *
1.14 + * @author Jaroslav Tulach <jtulach@netbeans.org>
1.15 + */
1.16 +@XmlAccessorType(XmlAccessType.FIELD)
1.17 +public class Note {
1.18 + @XmlValue
1.19 + private String comment;
1.20 + @XmlAttribute
1.21 + private Date when;
1.22 + @XmlAttribute
1.23 + private String who;
1.24 +
1.25 + private Note() {
1.26 + }
1.27 +
1.28 + public Note(String comment, Date when, String who) {
1.29 + this.comment = comment;
1.30 + this.when = new Date(when.getTime());
1.31 + this.who = who;
1.32 + }
1.33 +
1.34 + public String getComment() {
1.35 + return comment;
1.36 + }
1.37 +
1.38 + public Date getWhen() {
1.39 + return (Date) when.clone();
1.40 + }
1.41 +
1.42 + public String getWho() {
1.43 + return who;
1.44 + }
1.45 +
1.46 + @Override
1.47 + public String toString() {
1.48 + return "Note[" + who + "@" + when + ": " + comment + "]";
1.49 + }
1.50 +
1.51 + @Override
1.52 + public boolean equals(Object obj) {
1.53 + if (obj == null) {
1.54 + return false;
1.55 + }
1.56 + if (getClass() != obj.getClass()) {
1.57 + return false;
1.58 + }
1.59 + final Note other = (Note) obj;
1.60 + if ((this.comment == null) ? (other.comment != null) : !this.comment.equals(other.comment)) {
1.61 + return false;
1.62 + }
1.63 + if (this.when != other.when && (this.when == null || !this.when.equals(other.when))) {
1.64 + return false;
1.65 + }
1.66 + if ((this.who == null) ? (other.who != null) : !this.who.equals(other.who)) {
1.67 + return false;
1.68 + }
1.69 + return true;
1.70 + }
1.71 +
1.72 + @Override
1.73 + public int hashCode() {
1.74 + int hash = 7;
1.75 + hash = 59 * hash + (this.comment != null ? this.comment.hashCode() : 0);
1.76 + hash = 59 * hash + (this.when != null ? this.when.hashCode() : 0);
1.77 + hash = 59 * hash + (this.who != null ? this.who.hashCode() : 0);
1.78 + return hash;
1.79 + }
1.80 +
1.81 +
1.82 +}