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

Quick Search    Search Deep

com.clra.rowing
Class RowingSessionSnapshot  view RowingSessionSnapshot download RowingSessionSnapshot.java

java.lang.Object
  extended bycom.clra.rowing.RowingSessionSnapshot
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class RowingSessionSnapshot
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

A snapshot of the data held by rowing session. If more than one property of a rowing session needs to be read or written, it may be more efficient to read or write all properties, in order to minimize network transit times.

Version:
$Revision: 1.3 $ $Date: 2003/02/26 03:38:45 $

Field Summary
private  java.util.Date date
           
private  int hashCode
           
private  java.lang.Integer id
           
private  RowingSessionLevel level
           
private  RowingSessionState state
           
private  RowingSessionType type
           
 
Constructor Summary
RowingSessionSnapshot(java.lang.Integer id, RowingSessionState st, java.util.Date dt, RowingSessionLevel lv, RowingSessionType tp)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with another, and returns a numerical result based on the comparison.
 java.util.Date getDate()
          Returns the date (and time) of a rowing session
 java.lang.Integer getId()
          Returns the primary key of a rowing session.
 RowingSessionLevel getLevel()
          Returns the level of a rowing session
 RowingSessionState getState()
          Returns the state of a rowing session.
 RowingSessionType getType()
          Returns the type of a rowing session
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private java.lang.Integer id

date

private java.util.Date date

state

private RowingSessionState state

level

private RowingSessionLevel level

type

private RowingSessionType type

hashCode

private int hashCode
Constructor Detail

RowingSessionSnapshot

public RowingSessionSnapshot(java.lang.Integer id,
                             RowingSessionState st,
                             java.util.Date dt,
                             RowingSessionLevel lv,
                             RowingSessionType tp)
Method Detail

getId

public java.lang.Integer getId()
Returns the primary key of a rowing session. The id is immutable after a rowing session is created.


getState

public RowingSessionState getState()
Returns the state of a rowing session. The state of a rowing session can not be set directly. It is changed as a side-effect of other operations on a rowing session.


getDate

public java.util.Date getDate()
Returns the date (and time) of a rowing session


getLevel

public RowingSessionLevel getLevel()
Returns the level of a rowing session


getType

public RowingSessionType getType()
Returns the type of a rowing session


compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)