|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.planet_ink.coffee_mud.Common.DefaultTimeClock
public class DefaultTimeClock
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Common.interfaces.TimeClock |
---|
TimeClock.MoonPhase, TimeClock.Season, TimeClock.TidePhase, TimeClock.TimeOfDay, TimeClock.TimePeriod |
Field Summary | |
---|---|
protected int[] |
dawnToDusk
|
protected int |
day
|
protected int |
daysInMonth
|
protected int |
hoursInDay
|
protected long |
lastTicked
|
protected boolean |
loaded
|
protected java.lang.String |
loadName
|
protected int |
month
|
protected java.lang.String[] |
monthsInYear
|
protected int |
tickStatus
|
protected int |
time
|
protected java.lang.String[] |
weekNames
|
protected int |
year
|
protected java.lang.String[] |
yearNames
|
Constructor Summary | |
---|---|
DefaultTimeClock()
|
Method Summary | |
---|---|
void |
bumpDays(int num)
Increase this clocks time by the given number of days. |
void |
bumpHours(int num)
Increase this clocks time by the given number of hours. |
void |
bumpMonths(int num)
Increase this clocks time by the given number of months. |
void |
bumpWeeks(int num)
Increase this clocks time by the given number of weeks. |
void |
bumpYears(int num)
Increase this clocks time by the given number of years. |
int |
compareTo(CMObject o)
|
CMObject |
copyOf()
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed. |
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. |
long |
deriveMudHoursAfter(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 |
getHourOfDay()
Gets the current time of day (the hour). |
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. |
TimeClock.MoonPhase |
getMoonPhase(Room room)
Gets the moon phase an an enumeration. |
TimeClock.Season |
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 |
getTickStatus()
A coded status for this object during the period where its tick method is being called. |
TimeClock.TidePhase |
getTidePhase(Room room)
Gets the phase of the tides as an enumeration. |
TimeClock.TimeOfDay |
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 |
handleTimeChange()
Causes the world to visibly react to a change in time |
java.lang.String |
ID()
The CoffeeMud Java Class ID shared by all instances of this object. |
void |
initializeClass()
Called ONCE after all objects are loaded, but before the map is read in during initialization. |
void |
initializeINIClock(CMProps page)
Initialize ini clock by reading calendar values from the given properties page. |
java.lang.String |
L(java.lang.String str,
java.lang.String... xs)
|
java.lang.String |
name()
The nice displayable name of this instance of this object |
CMObject |
newInstance()
Returns a new instance of this class. |
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 |
setFromHoursSinceEpoc(long num)
Sets this clock to the given number of hours since epoc. |
boolean |
setHourOfDay(int t)
Sets the time of day (the hour). |
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. |
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. |
boolean |
tick(Tickable ticking,
int tickID)
this is the method which is called periodically by the threading engine. |
void |
tickTock(int howManyHours)
Alters the time/day by the given number of hours (forward or backward) |
protected void |
tickTock(int howManyHours,
boolean moveTheSky)
|
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. |
long |
toHoursSinceEpoc()
Returns the total hours since epoc |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int tickStatus
protected boolean loaded
protected java.lang.String loadName
protected volatile long lastTicked
protected int year
protected int month
protected int day
protected int time
protected int hoursInDay
protected java.lang.String[] monthsInYear
protected int daysInMonth
protected int[] dawnToDusk
protected java.lang.String[] weekNames
protected java.lang.String[] yearNames
Constructor Detail |
---|
public DefaultTimeClock()
Method Detail |
---|
public java.lang.String ID()
CMObject
ID
in interface CMObject
public java.lang.String name()
Tickable
name
in interface CMObject
name
in interface Tickable
Environmental.Name()
public CMObject newInstance()
CMObject
newInstance
in interface CMObject
public void initializeClass()
CMObject
initializeClass
in interface CMObject
public int getTickStatus()
Tickable
getTickStatus
in interface Tickable
Tickable.tick(Tickable, int)
public void setLoadName(java.lang.String name)
TimeClock
setLoadName
in interface TimeClock
name
- the new load nameTimeClock.save()
public int getHoursInDay()
TimeClock
getHoursInDay
in interface TimeClock
TimeClock.setHoursInDay(int)
public void setHoursInDay(int h)
TimeClock
setHoursInDay
in interface TimeClock
h
- the new hours in a dayTimeClock.getHoursInDay()
public int getDaysInMonth()
TimeClock
getDaysInMonth
in interface TimeClock
TimeClock.setDaysInMonth(int)
public void setDaysInMonth(int d)
TimeClock
setDaysInMonth
in interface TimeClock
d
- the new days in a monthTimeClock.getDaysInMonth()
public int getMonthsInYear()
TimeClock
getMonthsInYear
in interface TimeClock
TimeClock.setMonthsInYear(String[])
,
TimeClock.getMonthNames()
public java.lang.String[] getMonthNames()
TimeClock
getMonthNames
in interface TimeClock
TimeClock.setMonthsInYear(String[])
,
TimeClock.getMonthNames()
public void setMonthsInYear(java.lang.String[] months)
TimeClock
setMonthsInYear
in interface TimeClock
months
- the new month names in a yearTimeClock.getMonthNames()
,
TimeClock.getMonthsInYear()
public int[] getDawnToDusk()
TimeClock
getDawnToDusk
in interface TimeClock
TimeClock.getTODCode()
,
TimeClock.setDawnToDusk(int, int, int, int)
,
TimeClock.TimeOfDay
public java.lang.String[] getYearNames()
TimeClock
getYearNames
in interface TimeClock
TimeClock.setYearNames(String[])
public void setYearNames(java.lang.String[] years)
TimeClock
setYearNames
in interface TimeClock
years
- the new years namesTimeClock.getYearNames()
public void setDawnToDusk(int dawn, int day, int dusk, int night)
TimeClock
setDawnToDusk
in interface TimeClock
dawn
- the dawn hourday
- the day hourdusk
- the dusk hournight
- the night hourTimeClock.getDawnToDusk()
,
TimeClock.getTODCode()
,
TimeClock.TimeOfDay
public java.lang.String[] getWeekNames()
TimeClock
getWeekNames
in interface TimeClock
TimeClock.setDaysInWeek(String[])
,
TimeClock.getDaysInWeek()
public int getDaysInWeek()
TimeClock
getDaysInWeek
in interface TimeClock
TimeClock.setDaysInWeek(String[])
,
TimeClock.getWeekNames()
public void setDaysInWeek(java.lang.String[] days)
TimeClock
setDaysInWeek
in interface TimeClock
days
- the new days in each week string arrayTimeClock.getDaysInWeek()
,
TimeClock.getWeekNames()
public java.lang.String getShortestTimeDescription()
TimeClock
getShortestTimeDescription
in interface TimeClock
TimeClock.timeDescription(MOB, Room)
,
TimeClock.getShortTimeDescription()
public java.lang.String getShortTimeDescription()
TimeClock
getShortTimeDescription
in interface TimeClock
TimeClock.timeDescription(MOB, Room)
,
TimeClock.getShortestTimeDescription()
public void initializeINIClock(CMProps page)
TimeClock
initializeINIClock
in interface TimeClock
page
- the properties pagepublic java.lang.String L(java.lang.String str, java.lang.String... xs)
public java.lang.String timeDescription(MOB mob, Room room)
TimeClock
timeDescription
in interface TimeClock
mob
- the mob who wants to know the timeroom
- the room the room where the mob is wanting the time
TimeClock.getShortTimeDescription()
,
TimeClock.getShortestTimeDescription()
public int getYear()
TimeClock
getYear
in interface TimeClock
TimeClock.setYear(int)
public void setYear(int y)
TimeClock
setYear
in interface TimeClock
y
- the new yearTimeClock.getYear()
public TimeClock.Season getSeasonCode()
TimeClock
getSeasonCode
in interface TimeClock
TimeClock.Season
public int getMonth()
TimeClock
getMonth
in interface TimeClock
TimeClock.setMonth(int)
public void setMonth(int m)
TimeClock
setMonth
in interface TimeClock
m
- the new monthTimeClock.getMonth()
public TimeClock.MoonPhase getMoonPhase(Room room)
TimeClock
getMoonPhase
in interface TimeClock
room
- the room to check the moon phase for
TimeClock.MoonPhase
public TimeClock.TidePhase getTidePhase(Room room)
TimeClock
getTidePhase
in interface TimeClock
room
- the room to check the tide phase for
TimeClock.TidePhase
public int getDayOfMonth()
TimeClock
getDayOfMonth
in interface TimeClock
TimeClock.setDayOfMonth(int)
public void setDayOfMonth(int d)
TimeClock
setDayOfMonth
in interface TimeClock
d
- the new day of monthTimeClock.getDayOfMonth()
public int getHourOfDay()
TimeClock
getHourOfDay
in interface TimeClock
TimeClock.setHourOfDay(int)
public TimeClock.TimeOfDay getTODCode()
TimeClock
getTODCode
in interface TimeClock
TimeClock.setHourOfDay(int)
,
TimeClock.setDawnToDusk(int, int, int, int)
,
TimeClock.TimeOfDay
public boolean setHourOfDay(int t)
TimeClock
setHourOfDay
in interface TimeClock
t
- the time of day (the hour)
TimeClock.getHourOfDay()
public CMObject copyOf()
CMObject
copyOf
in interface CMObject
public TimeClock deriveClock(long millis)
TimeClock
deriveClock
in interface TimeClock
millis
- the milliseconds since 1970
TimeClock.deriveMillisAfter(TimeClock)
,
TimeClock.deriveEllapsedTimeString(long)
public java.lang.String deriveEllapsedTimeString(long millis)
TimeClock
deriveEllapsedTimeString
in interface TimeClock
millis
- the milliseconds of elapsed time represented
TimeClock.deriveMillisAfter(TimeClock)
,
TimeClock.deriveClock(long)
public long deriveMillisAfter(TimeClock C)
TimeClock
deriveMillisAfter
in interface TimeClock
C
- the earlier time clock object
TimeClock.deriveClock(long)
,
TimeClock.deriveEllapsedTimeString(long)
public long deriveMudHoursAfter(TimeClock C)
TimeClock
deriveMudHoursAfter
in interface TimeClock
C
- the earlier time clock object
TimeClock.deriveClock(long)
,
TimeClock.deriveEllapsedTimeString(long)
public void handleTimeChange()
TimeClock
handleTimeChange
in interface TimeClock
protected void tickTock(int howManyHours, boolean moveTheSky)
public void tickTock(int howManyHours)
TimeClock
tickTock
in interface TimeClock
howManyHours
- the how many hours to alter the time bypublic void bumpHours(int num)
TimeClock
bumpHours
in interface TimeClock
num
- the number to bumpTimeClock.tickTock(int)
,
TimeClock.bumpDays(int)
,
TimeClock.bumpWeeks(int)
,
TimeClock.bumpMonths(int)
,
TimeClock.bumpYears(int)
public void bumpDays(int num)
TimeClock
bumpDays
in interface TimeClock
num
- the number to bumpTimeClock.tickTock(int)
,
TimeClock.bumpHours(int)
,
TimeClock.bumpWeeks(int)
,
TimeClock.bumpMonths(int)
,
TimeClock.bumpYears(int)
public void bumpWeeks(int num)
TimeClock
bumpWeeks
in interface TimeClock
num
- the number to bumpTimeClock.tickTock(int)
,
TimeClock.bumpHours(int)
,
TimeClock.bumpDays(int)
,
TimeClock.bumpMonths(int)
,
TimeClock.bumpYears(int)
public void bumpMonths(int num)
TimeClock
bumpMonths
in interface TimeClock
num
- the number to bumpTimeClock.tickTock(int)
,
TimeClock.bumpHours(int)
,
TimeClock.bumpDays(int)
,
TimeClock.bumpWeeks(int)
,
TimeClock.bumpYears(int)
public void bumpYears(int num)
TimeClock
bumpYears
in interface TimeClock
num
- the number to bumpTimeClock.tickTock(int)
,
TimeClock.bumpHours(int)
,
TimeClock.bumpDays(int)
,
TimeClock.bumpWeeks(int)
,
TimeClock.bumpMonths(int)
public long toHoursSinceEpoc()
TimeClock
toHoursSinceEpoc
in interface TimeClock
TimeClock.setFromHoursSinceEpoc(long)
public void setFromHoursSinceEpoc(long num)
TimeClock
setFromHoursSinceEpoc
in interface TimeClock
num
- the new time, in hours since epoc.TimeClock.tickTock(int)
,
TimeClock.toHoursSinceEpoc()
public void save()
TimeClock
save
in interface TimeClock
TimeClock.setLoadName(String)
public boolean tick(Tickable ticking, int tickID)
Tickable
tick
in interface Tickable
ticking
- a reference to this Tickable objecttickID
- the TICKID_ constant describing this periodic call, as defined in Tickable
Tickable
,
ServiceEngine
,
TickableGroup
public int compareTo(CMObject o)
compareTo
in interface java.lang.Comparable<CMObject>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |