Package net.fortuna.ical4j.model
Class WeekDay
- java.lang.Object
-
- net.fortuna.ical4j.model.WeekDay
-
- All Implemented Interfaces:
Serializable
public class WeekDay extends Object implements Serializable
$Id$ Created: 19/12/2004 Defines a day of the week with a possible offset related to a MONTHLY or YEARLY occurrence.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WeekDay.Day
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object arg0)
static int
getCalendarDay(WeekDay weekday)
Returns the correspondingjava.util.Calendar.DAY_OF_WEEK
constant for the specifiedWeekDay
.WeekDay.Day
getDay()
static WeekDay
getDay(int calDay)
Returns the corresponding day constant to the specified java.util.Calendar.DAY_OF_WEEK property.static DayOfWeek
getDayOfWeek(WeekDay weekday)
static WeekDay
getMonthlyOffset(Calendar cal)
Returns a weekday/offset representation of the specified calendar.static WeekDay
getNegativeMonthlyOffset(Calendar cal)
Returns a weekday/negative offset representation of the specified calendar.int
getOffset()
static WeekDay
getWeekDay(DayOfWeek dayOfWeek)
Returns a weekday representation of the specified day of week.static WeekDay
getWeekDay(Calendar cal)
Returns a weekday representation of the specified calendar.static WeekDay
getWeekDay(WeekDay.Day day)
int
hashCode()
String
toString()
-
-
-
Field Detail
-
SU
public static final WeekDay SU
Sunday.
-
MO
public static final WeekDay MO
Monday.
-
TU
public static final WeekDay TU
Tuesday.
-
WE
public static final WeekDay WE
Wednesday.
-
TH
public static final WeekDay TH
Thursday.
-
FR
public static final WeekDay FR
Friday.
-
SA
public static final WeekDay SA
Saturday.
-
-
Constructor Detail
-
WeekDay
public WeekDay(String value)
- Parameters:
value
- a string representation of a week day
-
WeekDay
public WeekDay(WeekDay weekDay, int offset)
Constructs a new weekday instance based on the specified instance and offset.- Parameters:
weekDay
- a week day template for the instanceoffset
- a month offset value
-
-
Method Detail
-
getDay
public final WeekDay.Day getDay()
- Returns:
- Returns the day.
-
getOffset
public final int getOffset()
- Returns:
- Returns the offset.
-
getWeekDay
public static WeekDay getWeekDay(WeekDay.Day day)
-
getWeekDay
public static WeekDay getWeekDay(Calendar cal)
Returns a weekday representation of the specified calendar.- Parameters:
cal
- a calendar (java.util)- Returns:
- a weekday instance representing the specified calendar
-
getWeekDay
public static WeekDay getWeekDay(DayOfWeek dayOfWeek)
Returns a weekday representation of the specified day of week.- Parameters:
dayOfWeek
- day of the week- Returns:
- a weekday instance representing the specified calendar
-
getMonthlyOffset
public static WeekDay getMonthlyOffset(Calendar cal)
Returns a weekday/offset representation of the specified calendar.- Parameters:
cal
- a calendar (java.util)- Returns:
- a weekday instance representing the specified calendar
-
getNegativeMonthlyOffset
public static WeekDay getNegativeMonthlyOffset(Calendar cal)
Returns a weekday/negative offset representation of the specified calendar.- Parameters:
cal
- a calendar (java.util)- Returns:
- a weekday instance representing the specified calendar
-
getDay
public static WeekDay getDay(int calDay)
Returns the corresponding day constant to the specified java.util.Calendar.DAY_OF_WEEK property.- Parameters:
calDay
- a property value of java.util.Calendar.DAY_OF_WEEK- Returns:
- a string, or null if an invalid DAY_OF_WEEK property is specified
-
getCalendarDay
public static int getCalendarDay(WeekDay weekday)
Returns the correspondingjava.util.Calendar.DAY_OF_WEEK
constant for the specifiedWeekDay
.- Parameters:
weekday
- a week day instance- Returns:
- the corresponding
java.util.Calendar
day
-
-