Class Clock

java.lang.Object
  extended by CounterCollector
      extended by Clock

public class Clock
extends CounterCollector

Clock class


Constructor Summary
Clock()
          Clock constructor
 
Method Summary
 java.lang.String getHrs()
          Clock hour value getter
 java.lang.String getMin()
          Clock minute value getter
 java.lang.String getSec()
          Clock second value getter
 java.lang.String getValue()
          Clock global value (hour, minute, second) getter
 java.lang.String getValue(java.lang.String format)
          Clock global value (hour, minute, second) getter with format arg
 Clock setFormat(java.lang.String format)
          Clock output format setter
 Clock setHrs(int hrs)
          Clock hour value setter
 Clock setMin(int min)
          Clock minute value setter
 Clock setSec(int sec)
          Clock second value setter
 Clock setValue(int hrs, int min, int sec)
          Clock global value (hours, minute, second) setter
 java.lang.String toString()
          Clock default output method (outputs with Clock.format)
 Clock work()
          Clock work method (this makes the clock working)
 Clock workOnce()
          Clock work once method (same as Clock.work() but loops one time).
 
Methods inherited from class CounterCollector
decrement, getCounter, increment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Clock

public Clock()
Clock constructor

Since:
1.00
Method Detail

work

public Clock work()
Clock work method (this makes the clock working)

Returns:
Clock The current instance
Throws:
java.lang.InterruptedException - Thread.sleep() error
Since:
1.00

workOnce

public Clock workOnce()
Clock work once method (same as Clock.work() but loops one time). Useful when manual incrementation needed (tests, suitable cases).

Returns:
Clock The current instance
Throws:
java.lang.InterruptedException - Thread.sleep() error
Since:
1.00

setFormat

public Clock setFormat(java.lang.String format)
Clock output format setter

Parameters:
String - format The new output format (need to include %h%, %m% and %s%)
Returns:
Clock The current instance
Since:
1.00

setHrs

public Clock setHrs(int hrs)
Clock hour value setter

Parameters:
int - hrs The new hour value to set
Returns:
Clock The current instance
Since:
1.00

setMin

public Clock setMin(int min)
Clock minute value setter

Parameters:
int - min The new minute value to set
Returns:
Clock The current instance

setSec

public Clock setSec(int sec)
Clock second value setter

Parameters:
int - sec The new second value to set
Returns:
Clock The current instance
Since:
1.00

setValue

public Clock setValue(int hrs,
                      int min,
                      int sec)
Clock global value (hours, minute, second) setter

Parameters:
int - hrs The new hour value to set
int - min The new minute value to set
int - sec The new second value to set
Since:
1.00

getHrs

public java.lang.String getHrs()
Clock hour value getter

Returns:
String The current hour formatted ("%02d") value
Since:
1.00

getMin

public java.lang.String getMin()
Clock minute value getter

Returns:
String The current minute formatted ("%02d") value
Since:
1.00

getSec

public java.lang.String getSec()
Clock second value getter

Returns:
String The current second formatted ("%02d") value
Since:
1.00

getValue

public java.lang.String getValue()
Clock global value (hour, minute, second) getter

Returns:
String The current clock formatted (Clock.format) value
Since:
1.00

getValue

public java.lang.String getValue(java.lang.String format)
Clock global value (hour, minute, second) getter with format arg

Parameters:
String - format The on-demand wanted format value (see Clock.setFormat).
Returns:
String The current clock formatted value
Since:
1.00

toString

public java.lang.String toString()
Clock default output method (outputs with Clock.format)

Overrides:
toString in class java.lang.Object
Returns:
String The current clock formatted (Clock.format) value
Since:
1.00