barsuift.simLife.time
Class TimeCounter

java.lang.Object
  extended by java.util.Observable
      extended by barsuift.simLife.time.TimeCounter
All Implemented Interfaces:
java.lang.Comparable<TimeCounter>

public class TimeCounter
extends java.util.Observable
implements java.lang.Comparable<TimeCounter>


Constructor Summary
TimeCounter(TimeCounterState state)
          Default constructor
 
Method Summary
 int compareTo(TimeCounter o)
           
 boolean equals(java.lang.Object obj)
           
 int getDays()
          Get the number of days
 int getHours()
          Get the number of hours
 int getMinutes()
          Get the number of minutes
 int getSeconds()
          Get the number of seconds
 TimeCounterState getState()
           
 int hashCode()
           
 void increment()
          Increment the counter, and notify observers
 java.lang.String toString()
          Return a representation of this counter in the form "d days hh:mm:ss"
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeCounter

public TimeCounter(TimeCounterState state)
Default constructor

Method Detail

increment

public void increment()
Increment the counter, and notify observers


getSeconds

public int getSeconds()
Get the number of seconds

Returns:
a number in [0-59]

getMinutes

public int getMinutes()
Get the number of minutes

Returns:
a number in [0-59]

getHours

public int getHours()
Get the number of hours

Returns:
a number in [0-23]

getDays

public int getDays()
Get the number of days

Returns:
a number

getState

public TimeCounterState getState()

toString

public java.lang.String toString()
Return a representation of this counter in the form "d days hh:mm:ss"

Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(TimeCounter o)
Specified by:
compareTo in interface java.lang.Comparable<TimeCounter>

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2010. All Rights Reserved.