|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.programix.time.DayOfWeek
public final class DayOfWeek
An enumeration of the days of the week in the Gregorian calendar
and the US English language. Also following both Java's
placement of Sunday as the first day in Calendar (at
least as far as its constant value goes) and the traditions of
the US, Sunday (not Monday) is set as the first day of the week.
If instead you want to do sorting with Monday being the
first day of the week, there is a Comparator that handles that:
MONDAY_TO_SUNDAY_COMPARATOR.
| Field Summary | |
|---|---|
static DayOfWeek |
FRIDAY
The day of the week called Friday. |
static DayOfWeek |
MONDAY
The day of the week called Monday. |
static Comparator<DayOfWeek> |
MONDAY_TO_SUNDAY_COMPARATOR
Sorts as Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday with no protection against null's. |
static Comparator<DayOfWeek> |
MONDAY_TO_SUNDAY_NULL_FIRST_COMPARATOR
Sorts as null, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday (with any null's coming first). |
static Comparator<DayOfWeek> |
MONDAY_TO_SUNDAY_NULL_LAST_COMPARATOR
Sorts as Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, null (with any null's coming last). |
static DayOfWeek |
SATURDAY
The day of the week called Saturday. |
static Comparator<DayOfWeek> |
SATURDAY_TO_SUNDAY_COMPARATOR
Sorts as Saturday, Friday, Thursday, Wednesday, Tuesday, Monday, Sunday with no protection against null's. |
static Comparator<DayOfWeek> |
SATURDAY_TO_SUNDAY_NULL_FIRST_COMPARATOR
Sorts as null, Saturday, Friday, Thursday, Wednesday, Tuesday, Monday, Sunday (with any null's coming first). |
static Comparator<DayOfWeek> |
SATURDAY_TO_SUNDAY_NULL_LAST_COMPARATOR
Sorts as Saturday, Friday, Thursday, Wednesday, Tuesday, Monday, Sunday, null (with any null's coming last). |
static DayOfWeek |
SUNDAY
The day of the week called Sunday. |
static Comparator<DayOfWeek> |
SUNDAY_TO_MONDAY_COMPARATOR
Sorts as Sunday, Saturday, Friday, Thursday, Wednesday, Tuesday, Monday with no protection against null's. |
static Comparator<DayOfWeek> |
SUNDAY_TO_MONDAY_NULL_FIRST_COMPARATOR
Sorts as null, Sunday, Saturday, Friday, Thursday, Wednesday, Tuesday, Monday (with any null's coming first). |
static Comparator<DayOfWeek> |
SUNDAY_TO_MONDAY_NULL_LAST_COMPARATOR
Sorts as Sunday, Saturday, Friday, Thursday, Wednesday, Tuesday, Monday null (with any null's coming last). |
static Comparator<DayOfWeek> |
SUNDAY_TO_SATURDAY_COMPARATOR
Sorts as Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday with no protection against null's. |
static Comparator<DayOfWeek> |
SUNDAY_TO_SATURDAY_NULL_FIRST_COMPARATOR
Sorts as null, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday (with any null's coming first). |
static Comparator<DayOfWeek> |
SUNDAY_TO_SATURDAY_NULL_LAST_COMPARATOR
Sorts as Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, null (with any null's coming last). |
static DayOfWeek |
THURSDAY
The day of the week called Thursday. |
static DayOfWeek |
TUESDAY
The day of the week called Tuesday. |
static List<DayOfWeek> |
VALUE_LIST
An unmodifiable List of all the instances of DayOfWeek. |
static DayOfWeek |
WEDNESDAY
The day of the week called Wednesday. |
| Method Summary | |
|---|---|
int |
compareTo(DayOfWeek other)
The "natural ordering" considers Sunday to be the first day of the week. |
static DayOfWeek |
convertFromCalendar(int calendarDayOfWeek)
Returns one of the DayOfWeek instances converted from the value from the "day of week" field of java.util.Calendar. |
boolean |
equals(Object obj)
|
int |
getDaysUntil(DayOfWeek target)
Returns the number of days from this day of the week until the specified target day of the week which is always in the range 0..6. |
String |
getDisplayNameFull()
Returns the full US English name of the day (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday). |
String |
getDisplayNameMedium()
Returns the 3-char US English abbreviation for the day (Sun, Mon, Tue, Wed, Thu, Fri, Sat). |
String |
getDisplayNameShort()
Returns the 2-char US English abbreviation for the day (Su, Mo, Tu, We, Th, Fr, Sa). |
String |
getName()
Returns the name of the constant in Java (all caps: SUNDAY, MONDAY, etc). |
static DayOfWeek[] |
getValues()
Returns an array of all the instances of DayOfWeek. |
int |
hashCode()
|
boolean |
isFriday()
|
boolean |
isMonday()
|
boolean |
isNotFriday()
|
boolean |
isNotMonday()
|
boolean |
isNotSaturday()
|
boolean |
isNotSunday()
|
boolean |
isNotThursday()
|
boolean |
isNotTuesday()
|
boolean |
isNotWednesday()
|
boolean |
isSaturday()
|
boolean |
isSunday()
|
boolean |
isThursday()
|
boolean |
isTuesday()
|
boolean |
isWednesday()
|
String |
toString()
|
static DayOfWeek |
valueOf(String name)
Returns the instance whose getName() method returns
a String that matches the name passed in. |
static DayOfWeek |
valueOfDisplayNameFull(String fullName)
Returns the instance whose getDisplayNameFull() method returns
a String that matches the name passed in. |
static DayOfWeek |
valueOfDisplayNameMedium(String mediumName)
Returns the instance whose getDisplayNameMedium()
method returns
a String that matches the name passed in. |
static DayOfWeek |
valueOfDisplayNameShort(String shortName)
Returns the instance whose getDisplayNameShort()
method returns
a String that matches the name passed in. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final DayOfWeek SUNDAY
| Name | Display Name | ||
| Full | Medium | Short | |
| SUNDAY | Sunday | Sun | Su |
getName(),
getDisplayNameFull(), getDisplayNameMedium(), and
getDisplayNameShort().
public static final DayOfWeek MONDAY
| Name | Display Name | ||
| Full | Medium | Short | |
| MONDAY | Monday | Mon | Mo |
getName(),
getDisplayNameFull(), getDisplayNameMedium(), and
getDisplayNameShort().
public static final DayOfWeek TUESDAY
| Name | Display Name | ||
| Full | Medium | Short | |
| TUESDAY | Tuesday | Tue | Tu |
getName(),
getDisplayNameFull(), getDisplayNameMedium(), and
getDisplayNameShort().
public static final DayOfWeek WEDNESDAY
| Name | Display Name | ||
| Full | Medium | Short | |
| WEDNESDAY | Wednesday | Wed | We |
getName(),
getDisplayNameFull(), getDisplayNameMedium(), and
getDisplayNameShort().
public static final DayOfWeek THURSDAY
| Name | Display Name | ||
| Full | Medium | Short | |
| THURSDAY | Thursday | Thu | Th |
getName(),
getDisplayNameFull(), getDisplayNameMedium(), and
getDisplayNameShort().
public static final DayOfWeek FRIDAY
| Name | Display Name | ||
| Full | Medium | Short | |
| FRIDAY | Friday | Fri | Fr |
getName(),
getDisplayNameFull(), getDisplayNameMedium(), and
getDisplayNameShort().
public static final DayOfWeek SATURDAY
| Name | Display Name | ||
| Full | Medium | Short | |
| SATURDAY | Saturday | Sat | Sa |
getName(),
getDisplayNameFull(), getDisplayNameMedium(), and
getDisplayNameShort().
public static final List<DayOfWeek> VALUE_LIST
List of all the instances of DayOfWeek.
public static final Comparator<DayOfWeek> SUNDAY_TO_SATURDAY_COMPARATOR
public static final Comparator<DayOfWeek> SUNDAY_TO_SATURDAY_NULL_FIRST_COMPARATOR
public static final Comparator<DayOfWeek> SUNDAY_TO_SATURDAY_NULL_LAST_COMPARATOR
public static final Comparator<DayOfWeek> SATURDAY_TO_SUNDAY_COMPARATOR
public static final Comparator<DayOfWeek> SATURDAY_TO_SUNDAY_NULL_FIRST_COMPARATOR
public static final Comparator<DayOfWeek> SATURDAY_TO_SUNDAY_NULL_LAST_COMPARATOR
public static final Comparator<DayOfWeek> MONDAY_TO_SUNDAY_COMPARATOR
public static final Comparator<DayOfWeek> MONDAY_TO_SUNDAY_NULL_FIRST_COMPARATOR
public static final Comparator<DayOfWeek> MONDAY_TO_SUNDAY_NULL_LAST_COMPARATOR
public static final Comparator<DayOfWeek> SUNDAY_TO_MONDAY_COMPARATOR
public static final Comparator<DayOfWeek> SUNDAY_TO_MONDAY_NULL_FIRST_COMPARATOR
public static final Comparator<DayOfWeek> SUNDAY_TO_MONDAY_NULL_LAST_COMPARATOR
| Method Detail |
|---|
public static DayOfWeek[] getValues()
public static DayOfWeek valueOf(String name)
throws IllegalArgumentException
getName() method returns
a String that matches the name passed in.
The matching is done ignoring any case differences and after
trimming any leading or trailing whitespace on the string
passed in.
name - the name to search for.
IllegalArgumentException - if no match is found.
public static DayOfWeek valueOfDisplayNameFull(String fullName)
throws IllegalArgumentException
getDisplayNameFull() method returns
a String that matches the name passed in.
The matching is done ignoring any case differences and after
trimming any leading or trailing whitespace on the string
passed in.
fullName - the name to search for (Sunday, Monday, etc.)
IllegalArgumentException - if no match is found.
public static DayOfWeek valueOfDisplayNameMedium(String mediumName)
throws IllegalArgumentException
getDisplayNameMedium()
method returns
a String that matches the name passed in.
The matching is done ignoring any case differences and after
trimming any leading or trailing whitespace on the string
passed in.
mediumName - the name to search for (Sun, Mon, etc.)
IllegalArgumentException - if no match is found.
public static DayOfWeek valueOfDisplayNameShort(String shortName)
throws IllegalArgumentException
getDisplayNameShort()
method returns
a String that matches the name passed in.
The matching is done ignoring any case differences and after
trimming any leading or trailing whitespace on the string
passed in.
shortName - the name to search for (Su, Mo, Tu, etc.)
IllegalArgumentException - if no match is found.
public static DayOfWeek convertFromCalendar(int calendarDayOfWeek)
throws IllegalArgumentException
java.util.Calendar.
calendarDayOfWeek - value from the "day of week" field of
java.util.Calendar.
IllegalArgumentException - if the "day of week" code
passed in does not make sense.public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic int compareTo(DayOfWeek other)
MONDAY_TO_SUNDAY_COMPARATOR.
compareTo in interface Comparable<DayOfWeek>public String getName()
public String getDisplayNameFull()
public String getDisplayNameMedium()
public String getDisplayNameShort()
public int getDaysUntil(DayOfWeek target)
| This instance | target | Days Until |
| TUESDAY | WEDNESDAY | 1 |
| TUESDAY | FRIDAY | 3 |
| TUESDAY | SUNDAY | 5 |
| TUESDAY | MONDAY | 6 |
| TUESDAY | TUESDAY | 0 |
| SATURDAY | MONDAY | 2 |
public boolean isSunday()
public boolean isNotSunday()
public boolean isMonday()
public boolean isNotMonday()
public boolean isTuesday()
public boolean isNotTuesday()
public boolean isWednesday()
public boolean isNotWednesday()
public boolean isThursday()
public boolean isNotThursday()
public boolean isFriday()
public boolean isNotFriday()
public boolean isSaturday()
public boolean isNotSaturday()
|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||