Skip to content

Repository files navigation

ThreadAPI

The Library counting consecutive time

How To Use

extend your own class or create your annoymous class.

you should provide fps for APIThread.

APIThread(int fps)

or

APIThread(TimeUnitFactory.unit, value)

ex) APIThread(TimeUnitFactory.MS, 100) = APIThread(0.1)

ex) APIThread(TimeUnitFactory.MINUTE, 2)

i will introduce abstract APIThread's methods next.

Example code

APIThreadthread = newAPIThread(TimeUnitFactory.SECOND, 1) {
inttime;
/*when one tick is passed*/@OverridepublicvoidonThreadExecute() throwsInterruptedException {
System.out.println(++time + " Sec");
}
/*if your code on onThreadExecute() is too very heavy to calculate time normally,  The ThreadAPI create new time calculation and refresh.  then, this method is called.*/@OverridepublicvoidonKeepUp() {
}
/*when you call APIPause or etc, The ThreadAPI wakes up Thread.sleep().  then, this method is called*/@OverridepublicvoidonInterrupt() {
}
/*when you start thread, this method is called*/@OverridepublicvoidonStart() {
}
/*when you call APIPause(), this method is called*/@OverridepublicvoidonPause() {
}
/*when you call APIResume(), this methoid is called*/@OverridepublicvoidonResume() {
}
/*when you call APIStop(), this method is called*/@OverridepublicvoidonStop() {
}
};
// start threadthread.start();

Good Luck!

by GoldenMine (Korean)

blog.naver.com/ehe123

About

The Library counting consecutive time

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages