All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.time4j.OrdinalWeekdayElement Maven / Gradle / Ivy

There is a newer version: 4.38
Show newest version
/*
 * -----------------------------------------------------------------------
 * Copyright © 2013-2015 Meno Hochschild, 
 * -----------------------------------------------------------------------
 * This file (OrdinalWeekdayElement.java) is part of project Time4J.
 *
 * Time4J is free software: You can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * Time4J is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Time4J. If not, see .
 * -----------------------------------------------------------------------
 */

package net.time4j;


/**
 * 

The element for the ordinal weekday in month.

* *

An instance can be obtained using the expression * {@link PlainDate#WEEKDAY_IN_MONTH}. This interface inherits from * {@code AdjustableElement} and offers additional operator for setting * the weekday in month.

* * @author Meno Hochschild */ /*[deutsch] *

Das Element für den x-ten Wochentag im Monat.

* *

Eine Instanz ist erhältlich über den Ausdruck * {@link PlainDate#WEEKDAY_IN_MONTH}. Dieses Interface bietet neben * den vom Interface {@code AdjustableElement} geerbten Methoden * weitere Spezialmethoden zum Setzen des Wochentags im Monat.

* * @author Meno Hochschild */ public interface OrdinalWeekdayElement extends AdjustableElement { //~ Methoden ---------------------------------------------------------- /** *

Defines an operator which moves a date to the first given weekday * in month.

* * @param dayOfWeek first day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ /*[deutsch] *

Definiert einen Versteller, der ein Datum auf den ersten angegebenen * Wochentag eines Monats setzt.

* * @param dayOfWeek first day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ ElementOperator setToFirst(Weekday dayOfWeek); /** *

Defines an operator which moves a date to the second given weekday * in month.

* * @param dayOfWeek second day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ /*[deutsch] *

Definiert einen Versteller, der ein Datum auf den zweiten angegebenen * Wochentag eines Monats setzt.

* * @param dayOfWeek second day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ ElementOperator setToSecond(Weekday dayOfWeek); /** *

Defines an operator which moves a date to the third given weekday * in month.

* * @param dayOfWeek third day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ /*[deutsch] *

Definiert einen Versteller, der ein Datum auf den dritten angegebenen * Wochentag eines Monats setzt.

* * @param dayOfWeek third day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ ElementOperator setToThird(Weekday dayOfWeek); /** *

Defines an operator which moves a date to the fourth given weekday * in month.

* * @param dayOfWeek fourth day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ /*[deutsch] *

Definiert einen Versteller, der ein Datum auf den vierten angegebenen * Wochentag eines Monats setzt.

* * @param dayOfWeek fourth day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ ElementOperator setToFourth(Weekday dayOfWeek); /** *

Defines an operator which moves a date to the last given weekday * in month.

* * @param dayOfWeek last day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ /*[deutsch] *

Definiert einen Versteller, der ein Datum auf den letzten angegebenen * Wochentag eines Monats setzt.

* * @param dayOfWeek last day of week in month * @return operator directly applicable also on {@code PlainTimestamp} */ ElementOperator setToLast(Weekday dayOfWeek); /** *

Defines an operator which moves a date to the given ordinal weekday * in month.

* *

If given ordinal number is {@code Integer.MAX_VALUE} then the last weekday in month * will be determined. Note that only the values 1-4 can give the guarantee that the current * month will not be changed.

* * @param ordinal ordinal number * @param dayOfWeek last day of week in month * @return operator directly applicable also on {@code PlainTimestamp} * @since 4.1 */ /*[deutsch] *

Definiert einen Versteller, der ein Datum auf den x-ten angegebenen * Wochentag eines Monats setzt.

* *

Wenn die angegebene Ordnungsnummer {@code Integer.MAX_VALUE} ist, wird der letzte * Wochentag des Monats bestimmt. Zu beachten, nur die Werte 1-4 können garantieren, * daß der aktuelle Monat gleich bleibt.

* * @param ordinal ordinal number * @param dayOfWeek last day of week in month * @return operator directly applicable also on {@code PlainTimestamp} * @since 4.1 */ default ElementOperator setTo( int ordinal, Weekday dayOfWeek ) { switch (ordinal) { case 1: return this.setToFirst(dayOfWeek); case 2: return this.setToSecond(dayOfWeek); case 3: return this.setToThird(dayOfWeek); case 4: return this.setToFourth(dayOfWeek); case Integer.MAX_VALUE: return this.setToLast(dayOfWeek); default: throw new UnsupportedOperationException("Out of range: " + ordinal); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy