Class SpanOfWeekdays
- All Implemented Interfaces:
Serializable
,Iterable<Weekday>
,ChronoDisplay
Describes an arbitrary span of weekdays.
Following elements which are declared as constants are registered by this class:
- Since:
- 4.20
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Field Summary
Modifier and TypeFieldDescriptionstatic ChronoElement<Weekday>
Denotes the end of this span of weekdays (inclusive).static ChronoElement<Weekday>
Denotes the start of this span of weekdays. -
Method Summary
Modifier and TypeMethodDescriptionstatic SpanOfWeekdays
Creates a new span of weekdays.static SpanOfWeekdays
Creates a typical working week from Monday to Friday.static Chronology<SpanOfWeekdays>
Yields the associated chronology.boolean
static ChronoFormatter<SpanOfWeekdays>
Creates a formatter for given dynamic format pattern and locale.getEnd()
Obtains the end of this span of weekdays.getStart()
Obtains the start of this span of weekdays.int
hashCode()
iterator()
int
length()
Determines the count of days belonging to this span of weekdays.static SpanOfWeekdays
Creates a span of weekdays of only one day.toString()
Methods inherited from class net.time4j.engine.ChronoEntity
contains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, with
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
START
@FormattableElement(format="S", alt="s", dynamic=true) public static final ChronoElement<Weekday> STARTDenotes the start of this span of weekdays.
-
END
@FormattableElement(format="E", alt="e", dynamic=true) public static final ChronoElement<Weekday> ENDDenotes the end of this span of weekdays (inclusive).
-
-
Method Details
-
on
Creates a span of weekdays of only one day.
- Parameters:
day
- the single day of week which forms the span- Returns:
- span of weekdays consisting of only given day
-
betweenMondayAndFriday
Creates a typical working week from Monday to Friday.
- Returns:
- span of weekdays from Monday to Friday
-
between
Creates a new span of weekdays.
It is possible to choose the same weekday for start and end. Then the resulting span will just consist of one single weekday.
- Parameters:
start
- the starting weekdayend
- the ending weekday (inclusive)- Returns:
- new span of weekdays
-
getStart
Obtains the start of this span of weekdays.
- Returns:
- the starting weekday
-
getEnd
Obtains the end of this span of weekdays.
- Returns:
- the ending weekday
-
length
public int length()Determines the count of days belonging to this span of weekdays.
- Returns:
- count of days in range
1-7
-
iterator
-
formatter
Creates a formatter for given dynamic format pattern and locale.
The pattern is of
dynamic
type and only uses the symbol letters "S" (=START) and "E" (=END). The start must be present, but the end is optional. If the end is missing in parsing then it will be set to the start. The count of symbols controls the text width, and the output context can be set by an extra format attribute. Example:ChronoFormatter<SpanOfWeekdays> f = SpanOfWeekdays.formatter("SSSS[ 'to' EEEE]", Locale.ENGLISH); assertThat(f.format(SpanOfWeekdays.betweenMondayAndFriday()), is("Monday to Friday")); assertThat(f.parse("Sunday"), is(SpanOfWeekdays.on(Weekday.SUNDAY)));
- Parameters:
dynamicPattern
- format patternlocale
- the locale information- Returns:
- new formatter
- See Also:
START
,END
,PatternType.DYNAMIC
,Attributes.OUTPUT_CONTEXT
-
equals
-
hashCode
public int hashCode() -
toString
-
chronology
Yields the associated chronology.
- Returns:
- the underlying rule engine
-