com.planet_ink.coffee_mud.Libraries
Class CoffeeTime

java.lang.Object
  extended by com.planet_ink.coffee_mud.Libraries.StdLibrary
      extended by com.planet_ink.coffee_mud.Libraries.CoffeeTime
All Implemented Interfaces:
CMObject, CMLibrary, TimeManager, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class CoffeeTime
extends StdLibrary
implements TimeManager


Field Summary
protected  TimeClock globalClock
           
 
Fields inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.TimeManager
MILI_DAY, MILI_HOUR, MILI_MINUTE, MILI_MONTH, MILI_SECOND, MILI_WEEK, MILI_YEAR
 
Constructor Summary
CoffeeTime()
           
 
Method Summary
 java.lang.String convertHour(java.lang.String TheHour)
          Returns the regular Hours given the hours in the international format (military time)

Usage: ConvertHour(GetIn(req, "ENDHR"))
 java.lang.String date2AMPMString(long time)
          Returns the Minutes portion of a given Time

Usage: String ST_AMPM=T2_AMPMString();
 java.lang.String date2Date2String(long time)
          Converts a given date into a string of form: MM/DD/YY

Usage: d2D2String()
 java.lang.String date2DateString(long time)
          Converts a given date into a string of form: MM/DD/YYYY

Usage: d2DString()
 java.lang.String date2DayOfMonthString(long time)
          Returns the DD portion of a given date

Usage: String ENDDD=d2DDString();
 java.lang.String date2HRString(long time)
          Returns the Hours portion of a given Time

Usage: String ENDHR=T2HRString();
 java.lang.String date2MINString(long time)
          Returns the Minutes portion of a given Time

Usage: String ENDMIN=T2MINString();
 java.lang.String date2MonthString(long time)
          Returns the month for a given date

Usage: String ENDMM=d2MMString();
 java.lang.String date2SecondsString(long time)
          Converts a given date into a string of form: MM/DD/YYYY HH:MM AP

Usage: d2SString()
 java.lang.String date2String(java.util.Calendar C)
           
 java.lang.String date2String(long time)
          Converts a given date into a string of form: MM/DD/YYYY HH:MM AP

Usage: d2String()
 java.lang.String date2YYYYString(long time)
          Returns the YYYY portion of a given date Returns the DD portion of a given date

Usage: String ENDYYYY=d2YYYYString();
 java.lang.String date2ZoneString(long time)
          Returns the time zone of the server

Usage: MEETZN = T2ZoneString();
 java.lang.String getAMPM(java.lang.String TheHour)
          Returns the AMPM stamp given the international Hours portion the Time

Usage: getAMPM(GetIn(req, "ENDHR"))
 java.lang.String getMonthName(int Number, boolean GiveShort)
          Return the name of the month, given a number

Usage: String Mnth=ReturnMonthName(m,GiveShort).charStats();
 java.lang.String getTheIntZoneID(int theRawOffset)
          Get the zone id given the timezone string

Usage: GetTheZoneID(MeetTZ.getRawOffset())+"\n";
 java.lang.String getTheTimeZone(java.lang.String theID)
          Returns the time zone of the given ID

Usage: MEETZN = GetTheTimeZone(ID);
 TimeClock globalClock()
          Returns the mud wide global time clock object as defined by the coffeemud.ini file.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean isTickExpression(java.lang.String val)
          Parses whether a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears
 java.lang.String month2MM(java.lang.String Month)
          Returns the numeric representation of the month

Usage: Month2MM("January");
 int parseTickExpression(java.lang.String val)
          Parses either a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears
 java.lang.String smtpDateFormat(long time)
          format the date

Usage: msgDateFormat(98374987234)
 java.util.Calendar string2Date(java.lang.String TheDate)
          Converts a string of some form into a Calendar object.
 long string2Millis(java.lang.String TheDate)
          Converts a string of some form into a Calendar object.
 java.lang.String twoDigits(long num)
          Converts a number to two digits.
 
Methods inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
activate, compareTo, copyOf, getSupportThread, initializeClass, newInstance, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getSupportThread, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

globalClock

protected TimeClock globalClock
Constructor Detail

CoffeeTime

public CoffeeTime()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, MiscTech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdLibrary
Returns:
the name of this class

month2MM

public java.lang.String month2MM(java.lang.String Month)
Returns the numeric representation of the month

Usage: Month2MM("January");

Specified by:
month2MM in interface TimeManager
Parameters:
Month - The month name
Returns:
String The number of the month as a string

getMonthName

public java.lang.String getMonthName(int Number,
                                     boolean GiveShort)
Return the name of the month, given a number

Usage: String Mnth=ReturnMonthName(m,GiveShort).charStats();

Specified by:
getMonthName in interface TimeManager
Parameters:
Number - Month number to convert
GiveShort - Give abbreviation if true
Returns:
String Month name

string2Millis

public long string2Millis(java.lang.String TheDate)
Converts a string of some form into a Calendar object.

Usage: Calendar.S2Date(GetRes(Results,"StartDateTime"));

Specified by:
string2Millis in interface TimeManager
Parameters:
TheDate - The string to retrieve from
Returns:
Calendar Calendar object

string2Date

public java.util.Calendar string2Date(java.lang.String TheDate)
Converts a string of some form into a Calendar object.

Usage: Calendar.string2Date(GetRes(Results,"StartDateTime"));

Specified by:
string2Date in interface TimeManager
Parameters:
TheDate - The string to retrieve from
Returns:
Calendar Calendar object

convertHour

public java.lang.String convertHour(java.lang.String TheHour)
Returns the regular Hours given the hours in the international format (military time)

Usage: ConvertHour(GetIn(req, "ENDHR"))

Specified by:
convertHour in interface TimeManager
Parameters:
TheHour - Hours in military format
Returns:
String Hours in regular format

getAMPM

public java.lang.String getAMPM(java.lang.String TheHour)
Returns the AMPM stamp given the international Hours portion the Time

Usage: getAMPM(GetIn(req, "ENDHR"))

Specified by:
getAMPM in interface TimeManager
Parameters:
TheHour - Hours in military format
Returns:
String AM or PM stamp

getTheIntZoneID

public java.lang.String getTheIntZoneID(int theRawOffset)
Get the zone id given the timezone string

Usage: GetTheZoneID(MeetTZ.getRawOffset())+"\n";

Specified by:
getTheIntZoneID in interface TimeManager
Parameters:
theRawOffset - The time zone's raw offset to convert
Returns:
String The time zone ID

getTheTimeZone

public java.lang.String getTheTimeZone(java.lang.String theID)
Returns the time zone of the given ID

Usage: MEETZN = GetTheTimeZone(ID);

Specified by:
getTheTimeZone in interface TimeManager
Parameters:
theID - The ID of the abbreviated time zone.
Returns:
String The time zone name

date2MonthString

public java.lang.String date2MonthString(long time)
Returns the month for a given date

Usage: String ENDMM=d2MMString();

Specified by:
date2MonthString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String The month name

date2DayOfMonthString

public java.lang.String date2DayOfMonthString(long time)
Returns the DD portion of a given date

Usage: String ENDDD=d2DDString();

Specified by:
date2DayOfMonthString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String The day

twoDigits

public java.lang.String twoDigits(long num)
Converts a number to two digits.

Specified by:
twoDigits in interface TimeManager
Parameters:
num - the number
Returns:
the number as two digits

date2YYYYString

public java.lang.String date2YYYYString(long time)
Returns the YYYY portion of a given date Returns the DD portion of a given date

Usage: String ENDYYYY=d2YYYYString();

Specified by:
date2YYYYString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String The year

date2HRString

public java.lang.String date2HRString(long time)
Returns the Hours portion of a given Time

Usage: String ENDHR=T2HRString();

Specified by:
date2HRString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String The hour

date2MINString

public java.lang.String date2MINString(long time)
Returns the Minutes portion of a given Time

Usage: String ENDMIN=T2MINString();

Specified by:
date2MINString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String The minutes

date2ZoneString

public java.lang.String date2ZoneString(long time)
Returns the time zone of the server

Usage: MEETZN = T2ZoneString();

Specified by:
date2ZoneString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String The time zone

date2AMPMString

public java.lang.String date2AMPMString(long time)
Returns the Minutes portion of a given Time

Usage: String ST_AMPM=T2_AMPMString();

Specified by:
date2AMPMString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String AM or PM stamp

date2String

public java.lang.String date2String(java.util.Calendar C)
Specified by:
date2String in interface TimeManager

date2String

public java.lang.String date2String(long time)
Converts a given date into a string of form: MM/DD/YYYY HH:MM AP

Usage: d2String()

Specified by:
date2String in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String Formatted date/time

date2SecondsString

public java.lang.String date2SecondsString(long time)
Converts a given date into a string of form: MM/DD/YYYY HH:MM AP

Usage: d2SString()

Specified by:
date2SecondsString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String Formatted date/time

date2DateString

public java.lang.String date2DateString(long time)
Converts a given date into a string of form: MM/DD/YYYY

Usage: d2DString()

Specified by:
date2DateString in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String Formatted date

date2Date2String

public java.lang.String date2Date2String(long time)
Converts a given date into a string of form: MM/DD/YY

Usage: d2D2String()

Specified by:
date2Date2String in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String Formatted date

smtpDateFormat

public java.lang.String smtpDateFormat(long time)
format the date

Usage: msgDateFormat(98374987234)

Specified by:
smtpDateFormat in interface TimeManager
Parameters:
time - The time in miliseconds
Returns:
String The date

globalClock

public TimeClock globalClock()
Description copied from interface: TimeManager
Returns the mud wide global time clock object as defined by the coffeemud.ini file.

Specified by:
globalClock in interface TimeManager
Returns:
the global clock
See Also:
TimeClock

isTickExpression

public boolean isTickExpression(java.lang.String val)
Description copied from interface: TimeManager
Parses whether a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears

Specified by:
isTickExpression in interface TimeManager
Parameters:
val - the expression
Returns:
whether a number of ticks is represented by the string

parseTickExpression

public int parseTickExpression(java.lang.String val)
Description copied from interface: TimeManager
Parses either a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears

Specified by:
parseTickExpression in interface TimeManager
Parameters:
val - the expression
Returns:
the number of ticks represented by the string