Package org.simplesim.core.scheduling
Class Time
java.lang.Object
org.simplesim.core.scheduling.Time
- All Implemented Interfaces:
Comparable<Time>
Provides time and calendar functionality to scale and navigate the
simulation's time axis.
Ticks are stored as long
primitive. A time scale is provided,
standardized with one second set to one. The scale may be changed because
within the simulator, only the Time
wrapper is used.
This class is immutable and thus tread safe.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Time
static final int
static final int
static final int
static final Time
static final int
static final Time
static final int
static final Time
static final int
static final int
static final Time
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final Time
static final Time
static final Time
-
Constructor Summary
-
Method Summary
-
Field Details
-
SECONDS_PER_MINUTE
public static final int SECONDS_PER_MINUTE- See Also:
-
MINUTES_PER_HOUR
public static final int MINUTES_PER_HOUR- See Also:
-
HOURS_PER_DAY
public static final int HOURS_PER_DAY- See Also:
-
DAYS_PER_WEEK
public static final int DAYS_PER_WEEK- See Also:
-
DAYS_PER_MONTH
public static final int DAYS_PER_MONTH- See Also:
-
MONTHS_PER_YEAR
public static final int MONTHS_PER_YEAR- See Also:
-
DAYS_PER_YEAR
public static final int DAYS_PER_YEAR- See Also:
-
TICKS_PER_SECOND
public static final int TICKS_PER_SECOND- See Also:
-
TICKS_PER_MINUTE
public static final int TICKS_PER_MINUTE- See Also:
-
TICKS_PER_HOUR
public static final int TICKS_PER_HOUR- See Also:
-
TICKS_PER_DAY
public static final int TICKS_PER_DAY- See Also:
-
TICKS_PER_WEEK
public static final int TICKS_PER_WEEK- See Also:
-
TICKS_PER_MONTH
public static final int TICKS_PER_MONTH- See Also:
-
TICKS_PER_YEAR
public static final int TICKS_PER_YEAR- See Also:
-
ZERO
-
TICK
-
INFINITY
-
HOUR
-
DAY
-
WEEK
-
MONTH
-
YEAR
-
-
Constructor Details
-
Time
public Time(long value) Basic constructor- Parameters:
value
- number of ticks
-
Time
Copy constructor- Parameters:
time
- time to duplicate
-
Time
public Time(int year, int month, int day, int hour, int min, int sec) Constructor converting a given date into ticks- Parameters:
year
- the year (counting starts at zero)month
- the month (between 0 and 12, counting starts at zero)day
- the day (between 0 and 30, counting starts at zero)hour
- the hour (between 0 and 24)min
- the minute (between 0 and 60)sec
- the second (between 0 and 60)
-
Time
public Time(int day, int hour, int min) Constructor converting a given date into ticks, facilitating shorter time spans.- Parameters:
day
- the day (counting starts at zero)hour
- the hour (between 0 and 24)min
- the minute (between 0 and 60)
-
-
Method Details
-
getTicks
public long getTicks() -
add
-
add
-
sub
-
sub
-
isBefore
-
isAfter
-
minutes
public static long minutes(int minutes) -
hours
public static long hours(int hours) -
days
public static long days(int days) -
months
public static long months(int months) -
years
public static long years(int years) -
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Time>
-