Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

SomeUtils/Clock

package SomeUtils.Clock;

Alarm.java

import SomeUtils.Clock.Alarm;

Public Variables


public final static int millis;
public final static int seconds;
public final static int nanos;

These variables are for setting the unit of time.


public interface AlarmWatcher{
  public void isRinging(boolean ringing);
}

This interface is used to listen for the Alarm.


Public Methods


public void start();

Used for starting the inner timer.

Not recommended to be called manually; it is automatically called.


public void alarmAfter(final long duration, final int unit, final AlarmWatcher watcher);
public void alarmAfter(final long duration, final int unit);

The only thing an alarm clock should do.


Stopwatch.java

import SomeUtils.Clock.Stopwatch;

Public Variables


public final static int millis;
public final static int seconds;
public final static int nanos;

These variables are for setting the unit of time.


Public Methods


public void start();

Starts the stopwatch.


public long getTimeElapsed();
public long getTimeElapsed(final int unit);

Gets the time elapsed after the stopwatch was started.


public void lap();
public void split();

This records the current lap; splits.


public long[][] getLaps();

Takes the lap/split method from the object.


Timer.java

import SomeUtils.Clock.Timer;

Public Variables

public final static int millis;
public final static int seconds;
public final static int nanos;

These variables are for setting the unit of time.


public interface TimerWatcher{
  public void hasStopped(boolean stopped);
  public void timeElapsed(long nano, long millis, long seconds);
  public void timeLeft(long timeLeft);
}

Used to watch while the timer is running.


Public Methods

public void stopAfter(final long duration, final int unit);

Used to pause the thread for a duration.


public void setWatcher(final TimerWatcher watcher);

Used to latch a watcher before calling the method above.