com.clra.rowing
Class BoatView
java.lang.Object
|
+--com.clra.rowing.BoatView
- All Implemented Interfaces:
- Comparable, Serializable
- public class BoatView
- extends Object
- implements Comparable, Serializable
Read-only information about a boat.
- Version:
- $Id: BoatView.java,v 1.2 2002/02/18 18:03:44 rphall Exp $
- Author:
- Rick Hall
- See Also:
- Serialized Form
BoatView
public BoatView(int id,
String name,
int size,
String type)
throws ValidationException
getId
public int getId()
getName
public String getName()
getSize
public int getSize()
getType
public String getType()
equals
public boolean equals(Object o)
- Two boats are equal iff their id's are equal.
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Boat objects are hashed by id's
- Overrides:
hashCode
in class Object
compareTo
public int compareTo(Object o)
throws ClassCastException
- Defines a natural ordering for boats by name.
Note: this class has a natural ordering that is inconsistent with equals.
Equality is defined by boat id's, not by boat names.
- Specified by:
compareTo
in interface Comparable
- Parameters:
o
- A boat object.- Throws:
ClassCastException
- if o is not a boat object.