Class Time
java.lang.Object
com.eco.bio7.time.Time
This class provides methods to access the time and the counter of the Bio7
application.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleThe highest and the lowest frame rate (steps per second) of the calculation thread.static final intstatic final doublestatic final intThe shortest and the longest interval of the calculation thread in milliseconds. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddIntervalListener(Runnable listener) Adds a listener which is called when the interval (the speed) changes (in the thread which changed it).static voidaddPauseListener(Runnable listener) Adds a listener which is called when the pause changes (started or paused; in the thread which changed it).static voidcount()Increments the Bio7 counter.static intReturns the Bio7 counter.static doublegetFps()Returns the frame rate (calculation steps per second).static intReturns the time between two calculation steps.static longReturns the time between two calculation steps in nanoseconds.static intReturns the current modulo operator.static StringgetMonth()Returns the month.static intReturns the month.static intReturns the number of the month.static intMethod for the abiotic factors panel.static intgetTime()Returns the time.static intgetYear()Returns the year.static booleanisPause()Returns if the pause is activated.static voidremoveIntervalListener(Runnable listener) Removes a listener of the interval.static voidremovePauseListener(Runnable listener) Removes a listener of the pause.static voidsetCounter(int counter) Sets the Bio7 counter.static voidsetFps(double fps) Sets the frame rate (calculation steps per second).static voidsetInterval(int value) Sets the time between two calculation steps.static voidsetModtime(int modtime) Changes the current modulo operator (time % operator).static voidA method to rearrange the sequence of the month.static voidsetMonthnumber(int[] month) A method which will change the sequence of the month as a number.static voidsetNutrienttime(int time) Method for the abiotic factors panel.static voidsetPause(boolean pause) Sets or unsets the pause.static voidsetYear(int year) Sets the year.static voidResets the time.static void
-
Field Details
-
MIN_INTERVAL
public static final int MIN_INTERVALThe shortest and the longest interval of the calculation thread in milliseconds.- See Also:
-
MAX_INTERVAL
public static final int MAX_INTERVAL- See Also:
-
MAX_FPS
public static final double MAX_FPSThe highest and the lowest frame rate (steps per second) of the calculation thread.- See Also:
-
MIN_FPS
public static final double MIN_FPS- See Also:
-
-
Constructor Details
-
Time
public Time()
-
-
Method Details
-
Timeupdate
public static void Timeupdate() -
Timereset
public static void Timereset()Resets the time. -
getMonth
-
getYear
public static int getYear()Returns the year.- Returns:
- the year as an integer value.
-
getMonthcount
public static int getMonthcount()Returns the month.- Returns:
- the month as an integer value.
-
getMonthNumber
public static int getMonthNumber()Returns the number of the month.- Returns:
- the number of the month as an integer value.
-
getNutrienttime
public static int getNutrienttime()Method for the abiotic factors panel.- Returns:
- the nutrient time as an integer value.
-
setNutrienttime
public static void setNutrienttime(int time) Method for the abiotic factors panel.- Parameters:
time- the nutrient time as an integer value.
-
getCounter
public static int getCounter()Returns the Bio7 counter.- Returns:
- the counter as an integer value.
-
setCounter
public static void setCounter(int counter) Sets the Bio7 counter.- Parameters:
counter- the counter as an integer value.
-
count
public static void count()Increments the Bio7 counter. -
isPause
public static boolean isPause()Returns if the pause is activated.- Returns:
- a boolean value.
-
setPause
public static void setPause(boolean pause) Sets or unsets the pause.- Parameters:
pause- a boolean value.
-
addPauseListener
Adds a listener which is called when the pause changes (started or paused; in the thread which changed it).- Parameters:
listener- the listener
-
removePauseListener
Removes a listener of the pause. -
getModtime
public static int getModtime()Returns the current modulo operator.- Returns:
- the modulo operator as an integer value.
-
setModtime
public static void setModtime(int modtime) Changes the current modulo operator (time % operator).- Parameters:
modtime- the modulo operator as an integer value.
-
setMonth
A method to rearrange the sequence of the month. This method has to be used with the setMonthnumber method!- Parameters:
month- the month values as a string array.
-
setMonthnumber
public static void setMonthnumber(int[] month) A method which will change the sequence of the month as a number. This method has to be used with the setMonth method!- Parameters:
month- the sequence as an integer array.
-
setYear
public static void setYear(int year) Sets the year.- Parameters:
year- the year as an integer value.
-
getTime
public static int getTime()Returns the time.- Returns:
- the time as an integer value.
-
setInterval
public static void setInterval(int value) Sets the time between two calculation steps. The change takes effect immediately, also during a long interval.- Parameters:
value- the interval in milliseconds (limited to MIN_INTERVAL - MAX_INTERVAL).
-
setFps
public static void setFps(double fps) Sets the frame rate (calculation steps per second). The change takes effect immediately, also during a long interval.- Parameters:
fps- the frames per second (limited to MIN_FPS - MAX_FPS).
-
getFps
public static double getFps()Returns the frame rate (calculation steps per second).- Returns:
- the frames per second.
-
getIntervalNanos
public static long getIntervalNanos()Returns the time between two calculation steps in nanoseconds.- Returns:
- the interval in nanoseconds.
-
addIntervalListener
Adds a listener which is called when the interval (the speed) changes (in the thread which changed it). -
removeIntervalListener
Removes a listener of the interval. -
getInterval
public static int getInterval()Returns the time between two calculation steps.- Returns:
- the interval in milliseconds.
-