com.planet_ink.coffee_mud.Common.interfaces
Interface TimeClock

All Superinterfaces:
java.lang.Cloneable, CMCommon, CMObject, java.lang.Comparable<CMObject>, Tickable
All Known Implementing Classes:
DefaultTimeClock

public interface TimeClock
extends Tickable, CMCommon

This interface represents more than a "Time Zone", but a complete calendar, a complete lunar cycle, and schedule for days and nights. Oh, and it also manages the current date and time.

See Also:
Area.setTimeObj(TimeClock), Area.getTimeObj()

Field Summary
static java.lang.String[] MOON_PHASES
          The Moon Phase Constant MOON_PHASES, with long sentence descriptions of the various phases.
static int PHASE_BLUE
          The Moon Phase Constant PHASE_BLUE.
static java.lang.String[] PHASE_DESC
          The Moon Phase Constant PHASE_DESC, holding the coded short values of the moon phases.
static int PHASE_FULL
          The Moon Phase Constant PHASE_FULL.
static int PHASE_NEW
          The Moon Phase Constant PHASE_NEW.
static int PHASE_WANDEQUARTER
          The Moon Phase Constant PHASE_WANDEQUARTER.
static int PHASE_WANECRESCENT
          The Moon Phase Constant PHASE_WANECRESCENT.
static int PHASE_WANEGIBBOUS
          The Moon Phase Constant PHASE_WANEGIBBOUS.
static int PHASE_WAXCRESCENT
          The Moon Phase Constant PHASE_WAXCRESCENT.
static int PHASE_WAXGIBBOUS
          The Moon Phase Constant PHASE_WAXGIBBOUS.
static int PHASE_WAXQUARTER
          The Moon Phase Constant PHASE_WAXQUARTER.
static java.lang.String[] SEASON_DESCS
          The Season Constant SEASON_DESCS, with the string word name of each season.
static int SEASON_FALL
          The Season Constant SEASON_FALL.
static int SEASON_SPRING
          The Season Constant SEASON_SPRING.
static int SEASON_SUMMER
          The Season Constant SEASON_SUMMER.
static int SEASON_WINTER
          The Season Constant SEASON_WINTER.
static int TIME_DAWN
          The Time Of Day (TOD) Constant TIME_DAWN.
static int TIME_DAY
          The Time Of Day (TOD) Constant TIME_DAY.
static int TIME_DUSK
          The Time Of Day (TOD) Constant TIME_DUSK.
static int TIME_NIGHT
          The Time Of Day (TOD) Constant TIME_NIGHT.
static java.lang.String[] TOD_DESC
          The Constant TOD_DESC, with a sentence description of each sun-orientation (time of day).
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MOB, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SPELL_AFFECT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET, TICKMASK_SOLITARY
 
Method Summary
 TimeClock deriveClock(long millis)
          Using the current time and date as a yardstick, and assuming constant running and perfect timing, this method will derive a mud date and time from the given real life date/time in milliseconds.
 java.lang.String deriveEllapsedTimeString(long millis)
          Using the given number of milliseconds, this method will return a string describing the number of mud days, hours, etc that is represented by that amount of real time, assuming constant running and perfect timing.
 long deriveMillisAfter(TimeClock C)
          This method will discover the difference in mud hours between this time clock and the given EARLIER clock, assuming they use the same scale of measurement.
 int[] getDawnToDusk()
          Gets the dawn to dusk values, indexed by the TOD constants.
 int getDayOfMonth()
          Gets the current day of month.
 int getDaysInMonth()
          Gets the days in a month.
 int getDaysInWeek()
          Gets the number of days in each week
 int getHoursInDay()
          Gets the hours in a day.
 int getMonth()
          Gets the current month.
 java.lang.String[] getMonthNames()
          Gets the month names, in order, indexed by 0.
 int getMonthsInYear()
          Gets the months in a year.
 int getMoonPhase()
          Gets the moon phase an an enumeration.
 int getSeasonCode()
          Gets the season code.
 java.lang.String getShortestTimeDescription()
          Gets the shortest time description, showing only the date and time in brief numeric format.
 java.lang.String getShortTimeDescription()
          Gets a shorter time description, showing the date and time in full sentence format, but skipping lunar orientation.
 int getTimeOfDay()
          Gets the current time of day (the hour).
 int getTODCode()
          Gets the TOD code, which is the sun-orientation (morning, evening, etc)
 java.lang.String[] getWeekNames()
          Gets the week names, which is the names of the days of each week, a string array indexed by the day of the week - 1.
 int getYear()
          Gets the current year.
 java.lang.String[] getYearNames()
          Gets the names of the year, an arbitrary sized list that is rotated through from year to year.
 void initializeINIClock(CMProps page)
          Initialize ini clock by reading calendar values from the given properties page.
 void save()
          Saves the current time/date information where ever its supposed to be saved.
 void setDawnToDusk(int dawn, int day, int dusk, int night)
          Sets the dawn to dusk values as absolute hours when that particular time of day begins.
 void setDayOfMonth(int d)
          Sets the current day of month.
 void setDaysInMonth(int d)
          Sets the days in a month.
 void setDaysInWeek(java.lang.String[] days)
          Sets the number of days in each week by naming each of them in a string array
 void setHoursInDay(int h)
          Sets the hours in a day.
 void setLoadName(java.lang.String name)
          Sets the name of this time object for the purposes of database loading and saving.
 void setMonth(int m)
          Sets the current month.
 void setMonthsInYear(java.lang.String[] months)
          Sets the months in year as a string array of names, arranged in order.
 boolean setTimeOfDay(int t)
          Sets the time of day (the hour).
 void setYear(int y)
          Sets the current year.
 void setYearNames(java.lang.String[] years)
          Sets the year names, which is an arbitrary sized list that is rotated through from year to year.
 void tickTock(int howManyHours)
          Alters the time/day by the given number of hours (forward or backward)
 java.lang.String timeDescription(MOB mob, Room room)
          Returns a complete description of the date, time, and lunar orientation, and day of the week in a full sentence word format.
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
getTickStatus, name, tick
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

MOON_PHASES

static final java.lang.String[] MOON_PHASES
The Moon Phase Constant MOON_PHASES, with long sentence descriptions of the various phases.


PHASE_NEW

static final int PHASE_NEW
The Moon Phase Constant PHASE_NEW.

See Also:
Constant Field Values

PHASE_WAXCRESCENT

static final int PHASE_WAXCRESCENT
The Moon Phase Constant PHASE_WAXCRESCENT.

See Also:
Constant Field Values

PHASE_WAXQUARTER

static final int PHASE_WAXQUARTER
The Moon Phase Constant PHASE_WAXQUARTER.

See Also:
Constant Field Values

PHASE_WAXGIBBOUS

static final int PHASE_WAXGIBBOUS
The Moon Phase Constant PHASE_WAXGIBBOUS.

See Also:
Constant Field Values

PHASE_FULL

static final int PHASE_FULL
The Moon Phase Constant PHASE_FULL.

See Also:
Constant Field Values

PHASE_WANEGIBBOUS

static final int PHASE_WANEGIBBOUS
The Moon Phase Constant PHASE_WANEGIBBOUS.

See Also:
Constant Field Values

PHASE_WANDEQUARTER

static final int PHASE_WANDEQUARTER
The Moon Phase Constant PHASE_WANDEQUARTER.

See Also:
Constant Field Values

PHASE_WANECRESCENT

static final int PHASE_WANECRESCENT
The Moon Phase Constant PHASE_WANECRESCENT.

See Also:
Constant Field Values

PHASE_BLUE

static final int PHASE_BLUE
The Moon Phase Constant PHASE_BLUE.

See Also:
Constant Field Values

PHASE_DESC

static final java.lang.String[] PHASE_DESC
The Moon Phase Constant PHASE_DESC, holding the coded short values of the moon phases.


TOD_DESC

static final java.lang.String[] TOD_DESC
The Constant TOD_DESC, with a sentence description of each sun-orientation (time of day).


TIME_DAWN

static final int TIME_DAWN
The Time Of Day (TOD) Constant TIME_DAWN.

See Also:
Constant Field Values

TIME_DAY

static final int TIME_DAY
The Time Of Day (TOD) Constant TIME_DAY.

See Also:
Constant Field Values

TIME_DUSK

static final int TIME_DUSK
The Time Of Day (TOD) Constant TIME_DUSK.

See Also:
Constant Field Values

TIME_NIGHT

static final int TIME_NIGHT
The Time Of Day (TOD) Constant TIME_NIGHT.

See Also:
Constant Field Values

SEASON_SPRING

static final int SEASON_SPRING
The Season Constant SEASON_SPRING.

See Also:
Constant Field Values

SEASON_SUMMER

static final int SEASON_SUMMER
The Season Constant SEASON_SUMMER.

See Also:
Constant Field Values

SEASON_FALL

static final int SEASON_FALL
The Season Constant SEASON_FALL.

See Also:
Constant Field Values

SEASON_WINTER

static final int SEASON_WINTER
The Season Constant SEASON_WINTER.

See Also:
Constant Field Values

SEASON_DESCS

static final java.lang.String[] SEASON_DESCS
The Season Constant SEASON_DESCS, with the string word name of each season.

Method Detail

timeDescription

java.lang.String timeDescription(MOB mob,
                                 Room room)
Returns a complete description of the date, time, and lunar orientation, and day of the week in a full sentence word format.

Parameters:
mob - the mob who wants to know the time
room - the room the room where the mob is wanting the time
Returns:
the string representing the date and time
See Also:
getShortTimeDescription(), getShortestTimeDescription()

getShortTimeDescription

java.lang.String getShortTimeDescription()
Gets a shorter time description, showing the date and time in full sentence format, but skipping lunar orientation.

Returns:
the short time description
See Also:
timeDescription(MOB, Room), getShortestTimeDescription()

getShortestTimeDescription

java.lang.String getShortestTimeDescription()
Gets the shortest time description, showing only the date and time in brief numeric format.

Returns:
the shortest time description
See Also:
timeDescription(MOB, Room), getShortTimeDescription()

getYear

int getYear()
Gets the current year.

Returns:
the current year
See Also:
setYear(int)

setYear

void setYear(int y)
Sets the current year.

Parameters:
y - the new year
See Also:
getYear()

getMonth

int getMonth()
Gets the current month.

Returns:
the current month
See Also:
setMonth(int)

setMonth

void setMonth(int m)
Sets the current month.

Parameters:
m - the new month
See Also:
getMonth()

getDayOfMonth

int getDayOfMonth()
Gets the current day of month.

Returns:
the day of month
See Also:
setDayOfMonth(int)

setDayOfMonth

void setDayOfMonth(int d)
Sets the current day of month.

Parameters:
d - the new day of month
See Also:
getDayOfMonth()

getTimeOfDay

int getTimeOfDay()
Gets the current time of day (the hour).

Returns:
the time of day (hour)
See Also:
setTimeOfDay(int)

setTimeOfDay

boolean setTimeOfDay(int t)
Sets the time of day (the hour).

Parameters:
t - the time of day (the hour)
Returns:
true, if the new time denotes a change of sun-orientation, false otherwise
See Also:
getTimeOfDay()

getTODCode

int getTODCode()
Gets the TOD code, which is the sun-orientation (morning, evening, etc)

Returns:
the TOD code
See Also:
setTimeOfDay(int), setDawnToDusk(int, int, int, int), TIME_DAWN, TIME_DUSK, TIME_DAY, TIME_NIGHT, TOD_DESC

getMoonPhase

int getMoonPhase()
Gets the moon phase an an enumeration.

Returns:
the moon phase as an enumeration
See Also:
MOON_PHASES, PHASE_DESC, PHASE_FULL, PHASE_NEW

getSeasonCode

int getSeasonCode()
Gets the season code.

Returns:
the season code
See Also:
SEASON_DESCS, SEASON_FALL, SEASON_SPRING, SEASON_SUMMER, SEASON_WINTER

tickTock

void tickTock(int howManyHours)
Alters the time/day by the given number of hours (forward or backward)

Parameters:
howManyHours - the how many hours to alter the time by

save

void save()
Saves the current time/date information where ever its supposed to be saved. Requires that setLoadName be called before.

See Also:
setLoadName(String)

setLoadName

void setLoadName(java.lang.String name)
Sets the name of this time object for the purposes of database loading and saving. This is required for the save method to do anything at all.

Parameters:
name - the new load name
See Also:
save()

getHoursInDay

int getHoursInDay()
Gets the hours in a day.

Returns:
the hours in a day
See Also:
setHoursInDay(int)

setHoursInDay

void setHoursInDay(int h)
Sets the hours in a day.

Parameters:
h - the new hours in a day
See Also:
getHoursInDay()

getDaysInMonth

int getDaysInMonth()
Gets the days in a month.

Returns:
the days in a month
See Also:
setDaysInMonth(int)

setDaysInMonth

void setDaysInMonth(int d)
Sets the days in a month.

Parameters:
d - the new days in a month
See Also:
getDaysInMonth()

getMonthsInYear

int getMonthsInYear()
Gets the months in a year.

Returns:
the months in a year
See Also:
setMonthsInYear(String[]), getMonthNames()

getMonthNames

java.lang.String[] getMonthNames()
Gets the month names, in order, indexed by 0.

Returns:
the month names
See Also:
setMonthsInYear(String[]), getMonthNames()

setMonthsInYear

void setMonthsInYear(java.lang.String[] months)
Sets the months in year as a string array of names, arranged in order.

Parameters:
months - the new month names in a year
See Also:
getMonthNames(), getMonthsInYear()

getDawnToDusk

int[] getDawnToDusk()
Gets the dawn to dusk values, indexed by the TOD constants. Each entry is an hour when the TOD starts. The order of the values is DAWN, DAY, DUSK, NIGHT.

Returns:
the dawn to dusk array
See Also:
getTODCode(), setDawnToDusk(int, int, int, int), TIME_DAWN, TIME_DUSK, TIME_DAY, TIME_NIGHT, TOD_DESC

setDawnToDusk

void setDawnToDusk(int dawn,
                   int day,
                   int dusk,
                   int night)
Sets the dawn to dusk values as absolute hours when that particular time of day begins.

Parameters:
dawn - the dawn hour
day - the day hour
dusk - the dusk hour
night - the night hour
See Also:
getDawnToDusk(), getTODCode(), TIME_DAWN, TIME_DUSK, TIME_DAY, TIME_NIGHT, TOD_DESC

getWeekNames

java.lang.String[] getWeekNames()
Gets the week names, which is the names of the days of each week, a string array indexed by the day of the week - 1.

Returns:
the week names as an array of strings
See Also:
setDaysInWeek(String[]), getDaysInWeek()

getDaysInWeek

int getDaysInWeek()
Gets the number of days in each week

Returns:
the days in each week
See Also:
setDaysInWeek(String[]), getWeekNames()

setDaysInWeek

void setDaysInWeek(java.lang.String[] days)
Sets the number of days in each week by naming each of them in a string array

Parameters:
days - the new days in each week string array
See Also:
getDaysInWeek(), getWeekNames()

getYearNames

java.lang.String[] getYearNames()
Gets the names of the year, an arbitrary sized list that is rotated through from year to year. (think: "year of the donkey", etc..)

Returns:
the year names, if any.
See Also:
setYearNames(String[])

setYearNames

void setYearNames(java.lang.String[] years)
Sets the year names, which is an arbitrary sized list that is rotated through from year to year. (think: "year of the donkey", etc..)

Parameters:
years - the new years names
See Also:
getYearNames()

deriveClock

TimeClock deriveClock(long millis)
Using the current time and date as a yardstick, and assuming constant running and perfect timing, this method will derive a mud date and time from the given real life date/time in milliseconds.

Parameters:
millis - the milliseconds since 1970
Returns:
the time clock object representing that real life time
See Also:
deriveMillisAfter(TimeClock), deriveEllapsedTimeString(long)

deriveMillisAfter

long deriveMillisAfter(TimeClock C)
This method will discover the difference in mud hours between this time clock and the given EARLIER clock, assuming they use the same scale of measurement. It will then return the number of actual milliseconds would have elapsed, assuming constant running and perfect timing.

Parameters:
C - the earlier time clock object
Returns:
the number of milliseconds elapsed since the given clock
See Also:
deriveClock(long), deriveEllapsedTimeString(long)

deriveEllapsedTimeString

java.lang.String deriveEllapsedTimeString(long millis)
Using the given number of milliseconds, this method will return a string describing the number of mud days, hours, etc that is represented by that amount of real time, assuming constant running and perfect timing.

Parameters:
millis - the milliseconds of elapsed time represented
Returns:
the string representing the elapsed mud time
See Also:
deriveMillisAfter(TimeClock), deriveClock(long)

initializeINIClock

void initializeINIClock(CMProps page)
Initialize ini clock by reading calendar values from the given properties page. Does not load current values from anywhere.

Parameters:
page - the properties page