Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/clra/rowing/RowingSessionSnapshot.java


1   /*
2    * Copyright (c) Carnegie Lake Rowing Association 2002. All rights reserved.
3    * Distributed under the GPL license. See doc/COPYING.
4    * $RCSfile: RowingSessionSnapshot.java,v $
5    * $Date: 2003/02/26 03:38:45 $
6    * $Revision: 1.3 $
7    */
8   
9   package com.clra.rowing;
10  
11  import com.clra.util.ISerializableComparator;
12  import java.io.Serializable;
13  import java.rmi.RemoteException;
14  import java.util.Date;
15  import javax.ejb.EJBObject;
16  import javax.ejb.RemoveException;
17  
18  /**
19   * A snapshot of the data held by rowing session. If more than one property
20   * of a rowing session needs to be read or written, it may be more efficient
21   * to read or write all properties, in order to minimize network transit
22   * times.
23   *
24   * @version $Revision: 1.3 $ $Date: 2003/02/26 03:38:45 $
25   * @author <a href="mailto:rphall@pluto.njcc.com">Rick Hall</a>
26   */
27  public class RowingSessionSnapshot implements Comparable, Serializable {
28  
29    private Integer id;
30    private Date date;
31    private RowingSessionState state;
32    private RowingSessionLevel level;
33    private RowingSessionType type;
34    private int hashCode;
35  
36    public RowingSessionSnapshot( Integer id, RowingSessionState st,
37      Date dt, RowingSessionLevel lv, RowingSessionType tp ) {
38  
39      // Preconditions
40      if ( id == null ) {
41        throw new IllegalArgumentException( "null id" );
42      }
43      if ( st == null ) {
44        throw new IllegalArgumentException( "null state" );
45      }
46      if ( dt == null ) {
47        throw new IllegalArgumentException( "null date" );
48      }
49      if ( lv == null ) {
50        throw new IllegalArgumentException( "null level" );
51      }
52      if ( tp == null ) {
53        throw new IllegalArgumentException( "null type" );
54      }
55  
56      this.id = id;
57      this.state = st;
58      this.date = dt;
59      this.level = lv;
60      this.type = tp;
61      this.hashCode = id.hashCode();
62    }
63  
64    /**
65     * Returns the primary key of a rowing session. The id is immutable
66     * after a rowing session is created.
67     */
68    public Integer getId() {
69      return this.id;
70    }
71  
72    /**
73     * Returns the state of a rowing session. The state of a rowing
74     * session can not be set directly. It is changed as a side-effect
75     * of other operations on a rowing session.
76     */
77    public RowingSessionState getState() {
78      return this.state;
79    }
80  
81    /** Returns the date (and time) of a rowing session */
82    public Date getDate() {
83      return this.date;
84    }
85  
86    /** Returns the level of a rowing session */
87    public RowingSessionLevel getLevel() {
88      return this.level;
89    }
90  
91    /** Returns the type of a rowing session */
92    public RowingSessionType getType() {
93      return this.type;
94    }
95  
96    public int compareTo( Object o ) {
97      return DefaultRowingSessionComparator.staticCompare( this, o );
98    }
99  
100   public int hashCode() {
101     return this.hashCode;
102   }
103 
104 } // RowingSessionSnapshot
105 
106 /*
107  * $Log: RowingSessionSnapshot.java,v $
108  * Revision 1.3  2003/02/26 03:38:45  rphall
109  * Added copyright and GPL license
110  *
111  * Revision 1.2  2002/02/18 18:04:57  rphall
112  * Ran dos2unix to remove ^M (carriage return) from end of lines
113  *
114  * Revision 1.1.1.1  2002/01/03 21:57:28  rphall
115  * Initial load, 5th try, Jan-03-2002 4:57 PM
116  *
117  * Revision 1.1  2001/12/06 21:22:45  rphall
118  * Read-only snapshot of rowing-session data
119  *
120  */
121