View Javadoc

1   package uk.ac.ebi.intenz.domain.history;
2   
3   import uk.ac.ebi.intenz.domain.constants.Status;
4   
5   /**
6    * A future event adds some information to a history event as it has a status and a timeout associated.
7    *
8    * @author Michael Darsow
9    * @version $Revision: 1.2 $ $Date: 2008/01/28 12:33:04 $
10   */
11  public class FutureEvent extends HistoryEvent {
12  
13    private Status status;
14  
15    private Timeout timeout;
16  
17    /**
18     * Nothing special here.
19     */
20    public FutureEvent() {
21      super();
22      status = Status.SUGGESTED;
23      timeout = new Timeout();
24    }
25  
26    /**
27     * Checks if two <code>FutureEvent</code> objects are equal.
28     *
29     * @param o The other <code>HistoryEvent</code> to compare with this one.
30     * @return <code>true</code>, if the two objects are equal.
31     */
32    public boolean equals(Object o) {
33      if (this == o) return true;
34      if (!(o instanceof FutureEvent)) return false;
35      if (!super.equals(o)) return false;
36  
37      final FutureEvent event = (FutureEvent) o;
38  
39      if (status != null ? !status.equals(event.status) : event.status != null) return false;
40      if (timeout != null ? !timeout.equals(event.timeout) : event.timeout != null) return false;
41  
42      return true;
43    }
44  
45    /**
46     * Calculates a unique hash code.
47     *
48     * @return the hash code.
49     */
50    public int hashCode() {
51      int result = super.hashCode();
52      result = 29 * result + (status != null ? status.hashCode() : 0);
53      result = 29 * result + (timeout != null ? timeout.hashCode() : 0);
54      return result;
55    }
56  
57    
58  
59  
60    // --------------------- GETTER -----------------------------
61  
62    public Status getStatus() {
63      return status;
64    }
65  
66    public void setStatus(Status status) {
67      if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
68      this.status = status;
69    }
70  
71    public Timeout getTimeout() {
72      return timeout;
73    }
74  
75    public void setTimeout(Timeout timeout) {
76      if (timeout == null) throw new NullPointerException("Parameter 'timeout' must not be null.");
77      this.timeout = timeout;
78    }
79  
80  }