Top Description Inners Fields Constructors Methods
net.fortuna.ical4j.model

public Class WeekDay

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
net.fortuna.ical4j.util.Numbers, org.apache.commons.lang3.builder.HashCodeBuilder, java.io.Serializable, java.time.DayOfWeek, java.util.Calendar, .Objects

$Id$ Created: 19/12/2004 Defines a day of the week with a possible offset related to a MONTHLY or YEARLY occurrence.
Author
Ben Fortuna

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final WeekDay.Day
public static final WeekDay
FR

Friday.

public static final WeekDay
MO

Monday.

private final int
public static final WeekDay
SA

Saturday.

private static final long
public static final WeekDay
SU

Sunday.

public static final WeekDay
TH

Thursday.

public static final WeekDay
TU

Tuesday.

public static final WeekDay
WE

Wednesday.

Constructor Summary

AccessConstructor and Description
public
WeekDay(final String
a string representation of a week day
value
)

private
WeekDay(final WeekDay.Day
a string representation of a week day
day
,
final int
a month offset value
offset
)

public
WeekDay(final WeekDay
a week day template for the instance
weekDay
,
final int
a month offset value
offset
)

Constructs a new weekday instance based on the specified instance and offset.

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(final Object
the reference object with which to compare.
arg0
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static int

Returns:

the corresponding java.util.Calendar day
getCalendarDay
(final WeekDay
a week day instance
weekday
)

Returns the corresponding java.util.Calendar.DAY_OF_WEEK constant for the specified WeekDay.

public final WeekDay.Day

Returns:

Returns the day.
getDay
()

public static WeekDay

Returns:

a string, or null if an invalid DAY_OF_WEEK property is specified
getDay
(final int
a property value of java.util.Calendar.DAY_OF_WEEK
calDay
)

Returns the corresponding day constant to the specified java.util.Calendar.DAY_OF_WEEK property.

public static DayOfWeek
public static WeekDay

Returns:

a weekday instance representing the specified calendar
getMonthlyOffset
(final Calendar
a calendar (java.util)
cal
)

Returns a weekday/offset representation of the specified calendar.

public static WeekDay

Returns:

a weekday instance representing the specified calendar
getNegativeMonthlyOffset
(final Calendar
a calendar (java.util)
cal
)

Returns a weekday/negative offset representation of the specified calendar.

public final int

Returns:

Returns the offset.
getOffset
()

public static WeekDay
public static WeekDay

Returns:

a weekday instance representing the specified calendar
getWeekDay
(final Calendar
a calendar (java.util)
cal
)

Returns a weekday representation of the specified calendar.

public static WeekDay

Returns:

a weekday instance representing the specified calendar
getWeekDay
(DayOfWeek
day of the week
dayOfWeek
)

Returns a weekday representation of the specified day of week.

public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

dayback to summary
private final WeekDay.Day day
FRback to summary
public static final WeekDay FR

Friday.

MOback to summary
public static final WeekDay MO

Monday.

offsetback to summary
private final int offset
SAback to summary
public static final WeekDay SA

Saturday.

serialVersionUIDback to summary
private static final long serialVersionUID
SUback to summary
public static final WeekDay SU

Sunday.

THback to summary
public static final WeekDay TH

Thursday.

TUback to summary
public static final WeekDay TU

Tuesday.

WEback to summary
public static final WeekDay WE

Wednesday.

Constructor Detail

WeekDayback to summary
public WeekDay(final String value)
Parameters
value:String

a string representation of a week day

WeekDayback to summary
private WeekDay(final WeekDay.Day day, final int offset)
Parameters
day:WeekDay.Day

a string representation of a week day

offset:int

a month offset value

WeekDayback to summary
public WeekDay(final WeekDay weekDay, final int offset)

Constructs a new weekday instance based on the specified instance and offset.

Parameters
weekDay:WeekDay

a week day template for the instance

offset:int

a month offset value

Method Detail

equalsback to summary
public final boolean equals(final Object arg0)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
arg0:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getCalendarDayback to summary
public static int getCalendarDay(final WeekDay weekday)

Returns the corresponding java.util.Calendar.DAY_OF_WEEK constant for the specified WeekDay.

Parameters
weekday:WeekDay

a week day instance

Returns:int

the corresponding java.util.Calendar day

getDayback to summary
public final WeekDay.Day getDay()
Returns:WeekDay.Day

Returns the day.

getDayback to summary
public static WeekDay getDay(final int calDay)

Returns the corresponding day constant to the specified java.util.Calendar.DAY_OF_WEEK property.

Parameters
calDay:int

a property value of java.util.Calendar.DAY_OF_WEEK

Returns:WeekDay

a string, or null if an invalid DAY_OF_WEEK property is specified

getDayOfWeekback to summary
public static DayOfWeek getDayOfWeek(WeekDay weekday)
getMonthlyOffsetback to summary
public static WeekDay getMonthlyOffset(final Calendar cal)

Returns a weekday/offset representation of the specified calendar.

Parameters
cal:Calendar

a calendar (java.util)

Returns:WeekDay

a weekday instance representing the specified calendar

getNegativeMonthlyOffsetback to summary
public static WeekDay getNegativeMonthlyOffset(final Calendar cal)

Returns a weekday/negative offset representation of the specified calendar.

Parameters
cal:Calendar

a calendar (java.util)

Returns:WeekDay

a weekday instance representing the specified calendar

getOffsetback to summary
public final int getOffset()
Returns:int

Returns the offset.

getWeekDayback to summary
public static WeekDay getWeekDay(WeekDay.Day day)
getWeekDayback to summary
public static WeekDay getWeekDay(final Calendar cal)

Returns a weekday representation of the specified calendar.

Parameters
cal:Calendar

a calendar (java.util)

Returns:WeekDay

a weekday instance representing the specified calendar

getWeekDayback to summary
public static WeekDay getWeekDay(DayOfWeek dayOfWeek)

Returns a weekday representation of the specified day of week.

Parameters
dayOfWeek:DayOfWeek

day of the week

Returns:WeekDay

a weekday instance representing the specified calendar

hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
net.fortuna.ical4j.model back to summary

public final Enum WeekDay.Day

extends Enum<WeekDay.Day>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final WeekDay.Day
public static final WeekDay.Day
public static final WeekDay.Day
public static final WeekDay.Day
public static final WeekDay.Day
public static final WeekDay.Day
public static final WeekDay.Day

Constructor Summary

AccessConstructor and Description
private
Day()

Method Summary

Modifier and TypeMethod and Description
public static WeekDay.Day
public static WeekDay.Day[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FRback to summary
public static final WeekDay.Day FR
MOback to summary
public static final WeekDay.Day MO
SAback to summary
public static final WeekDay.Day SA
SUback to summary
public static final WeekDay.Day SU
THback to summary
public static final WeekDay.Day TH
TUback to summary
public static final WeekDay.Day TU
WEback to summary
public static final WeekDay.Day WE

Constructor Detail

Dayback to summary
private Day()

Method Detail

valueOfback to summary
public static WeekDay.Day valueOf(String name)
valuesback to summary
public static WeekDay.Day[] values()