barsuift.simLife.time
Class SimLifeCalendar

java.lang.Object
  extended by java.util.Calendar
      extended by barsuift.simLife.time.SimLifeCalendar
All Implemented Interfaces:
Persistent<SimLifeCalendarState>, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Calendar>

public class SimLifeCalendar
extends java.util.Calendar
implements Persistent<SimLifeCalendarState>

See Also:
Serialized Form

Field Summary
static int DAY_PER_MONTH
           
static int DAY_PER_WEEK
           
static int DAY_PER_YEAR
           
static int FIRDAY
          Value of the Calendar.DAY_OF_WEEK field indicating Firday.
static int MINUTE_PER_DAY
           
static int MONTH_PER_YEAR
           
static int MS_PER_SECOND
           
static int NOSDAY
          Value of the Calendar.DAY_OF_WEEK field indicating Nosday.
static int SECOND_PER_MINUTE
           
static int STOODAY
          Value of the Calendar.DAY_OF_WEEK field indicating Stooday.
static int THUNSDAY
          Value of the Calendar.DAY_OF_WEEK field indicating Thunsday.
static int WATSDAY
          Value of the Calendar.DAY_OF_WEEK field indicating Watsday.
static int WEEK_PER_MONTH
           
static int WEEK_PER_YEAR
           
static int WINDAY
          Value of the Calendar.DAY_OF_WEEK field indicating Winday.
 
Fields inherited from class java.util.Calendar
ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
 
Constructor Summary
SimLifeCalendar()
           
SimLifeCalendar(long millis)
           
SimLifeCalendar(SimLifeCalendar copy)
           
SimLifeCalendar(SimLifeCalendarState calendarState)
           
SimLifeCalendar(java.lang.String date)
           
 
Method Summary
 void add(int field, int amount)
           
protected  void computeFields()
           
protected  void computeTime()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String formatDate()
          Date is formatted with the following pattern : mm:ss DayInWeek DayInMonth Month Year.
 int getGreatestMinimum(int field)
           
 int getLeastMaximum(int field)
           
 int getMaximum(int field)
           
 int getMinimum(int field)
           
 SimLifeCalendarState getState()
          Gets the state of the persistent object.
 void roll(int field, boolean up)
           
 void roll(int field, int amount)
           
 void setTime(java.lang.String date)
          Parse the given date and set the given values to this calendar instance.
 void synchronize()
          Synchronizes the State instance with the current object state.
 
Methods inherited from class java.util.Calendar
after, before, clear, clear, clone, compareTo, complete, get, getActualMaximum, getActualMinimum, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, getTimeZone, hashCode, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOSDAY

public static final int NOSDAY
Value of the Calendar.DAY_OF_WEEK field indicating Nosday.


WATSDAY

public static final int WATSDAY
Value of the Calendar.DAY_OF_WEEK field indicating Watsday.


STOODAY

public static final int STOODAY
Value of the Calendar.DAY_OF_WEEK field indicating Stooday.


FIRDAY

public static final int FIRDAY
Value of the Calendar.DAY_OF_WEEK field indicating Firday.


THUNSDAY

public static final int THUNSDAY
Value of the Calendar.DAY_OF_WEEK field indicating Thunsday.


WINDAY

public static final int WINDAY
Value of the Calendar.DAY_OF_WEEK field indicating Winday.


MS_PER_SECOND

public static final int MS_PER_SECOND
See Also:
Constant Field Values

SECOND_PER_MINUTE

public static final int SECOND_PER_MINUTE
See Also:
Constant Field Values

MINUTE_PER_DAY

public static final int MINUTE_PER_DAY
See Also:
Constant Field Values

DAY_PER_WEEK

public static final int DAY_PER_WEEK
See Also:
Constant Field Values

WEEK_PER_MONTH

public static final int WEEK_PER_MONTH
See Also:
Constant Field Values

DAY_PER_MONTH

public static final int DAY_PER_MONTH
See Also:
Constant Field Values

MONTH_PER_YEAR

public static final int MONTH_PER_YEAR
See Also:
Constant Field Values

WEEK_PER_YEAR

public static final int WEEK_PER_YEAR
See Also:
Constant Field Values

DAY_PER_YEAR

public static final int DAY_PER_YEAR
See Also:
Constant Field Values
Constructor Detail

SimLifeCalendar

public SimLifeCalendar()

SimLifeCalendar

public SimLifeCalendar(java.lang.String date)

SimLifeCalendar

public SimLifeCalendar(long millis)

SimLifeCalendar

public SimLifeCalendar(SimLifeCalendar copy)

SimLifeCalendar

public SimLifeCalendar(SimLifeCalendarState calendarState)
Method Detail

getState

public SimLifeCalendarState getState()
Description copied from interface: Persistent
Gets the state of the persistent object.

Implementing class should consider systematically calling the Persistent.synchronize() method before returning the actual state. It is not up to clients to synchronize the object themselves.

Specified by:
getState in interface Persistent<SimLifeCalendarState>
Returns:
the object state

synchronize

public void synchronize()
Description copied from interface: Persistent
Synchronizes the State instance with the current object state.

It is not up to clients to synchronize the object themselves. Instead, this method should be called by the Persistent.getState() method.

On the other hand, this method is provided to allow aggregation classes to synchronize their aggregated instances without requiring the call to the Persistent.getState() method.

Specified by:
synchronize in interface Persistent<SimLifeCalendarState>

computeTime

protected void computeTime()
Specified by:
computeTime in class java.util.Calendar

computeFields

protected void computeFields()
Specified by:
computeFields in class java.util.Calendar

add

public void add(int field,
                int amount)
Specified by:
add in class java.util.Calendar

roll

public void roll(int field,
                 boolean up)
Specified by:
roll in class java.util.Calendar

roll

public void roll(int field,
                 int amount)
Overrides:
roll in class java.util.Calendar

getMinimum

public int getMinimum(int field)
Specified by:
getMinimum in class java.util.Calendar

getMaximum

public int getMaximum(int field)
Specified by:
getMaximum in class java.util.Calendar

getGreatestMinimum

public int getGreatestMinimum(int field)
Specified by:
getGreatestMinimum in class java.util.Calendar

getLeastMaximum

public int getLeastMaximum(int field)
Specified by:
getLeastMaximum in class java.util.Calendar

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.util.Calendar

formatDate

public java.lang.String formatDate()
Date is formatted with the following pattern : mm:ss DayInWeek DayInMonth Month Year. For example, it can be 19:59 Nosday 18 Tom 0455

Here are the rules to be applied when formatting :

Returns:
the formatted date

setTime

public void setTime(java.lang.String date)
Parse the given date and set the given values to this calendar instance. The date must be formatted as the formatDate() method would generate.

Parameters:
date - the date to parse


Copyright © 2010. All Rights Reserved.