|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Watch
public class Watch
This class represents a watch. A watch has the time, a colour and an owner. Each watch also has a unique id (all watches have a different id).
Field Summary | |
---|---|
static int |
BLUE
The colour blue. |
static int |
RED
The colour red. |
static int |
WHITE
The colour white. |
Constructor Summary | |
---|---|
Watch(int colour,
String owner)
Creates a watch with the given colour and owner and the current time. |
|
Watch(String owner)
Creates a white watch with the current time and the given owner. |
Method Summary | |
---|---|
boolean |
equals(Object object)
Tests if this watch is equal to the given object. |
int |
getColour()
Returns the colour of this watch. |
int |
getId()
Returns the id of this watch. |
String |
getOwner()
Returns the owner of this watch. |
long |
getTime()
Returns the time of this watch (the number of milliseconds since January 1, 1970). |
void |
setOwner(String owner)
Sets the owner of this watch to the given owner. |
String |
toString()
Returns a string representation of this watch. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int RED
public static final int WHITE
public static final int BLUE
Constructor Detail |
---|
public Watch(int colour, String owner)
colour
- the colour of the watch.owner
- the owner of the watch.public Watch(String owner)
owner
- the owner of the watch.Method Detail |
---|
public int getId()
public long getTime()
public int getColour()
public String getOwner()
public void setOwner(String owner)
owner
- the owner to setpublic boolean equals(Object object)
equals
in class Object
object
- an object.
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |