) { return Weekmodel.of( firstDayOfWeek, minimalDaysInFirstWeek,
/** * <p>Gets a suitable weekmodel for the default locale of system. </p> * * <p>Note: In order to get a weekend definition deviating from the * standard Saturday + Sunday, the i18n-module must be present in * classpath since v2.2. </p> * * @return week model in system locale * @see Locale#getDefault() */ /*[deutsch] * <p>Ermittelt ein geeignetes Wochenmodell für die aktuelle * Landeseinstellung des Systems. </p> * * <p>Hinweis: Damit eine von Samstag und Sonntag abweichende * lokalisierte Wochenenddefinition erzeugt werden kann, muß * seit Version v2.2 das i18n-Modul im Klassenpfad vorhanden sein. </p> * * @return week model in system locale * @see Locale#getDefault() */ public static Weekmodel ofSystem() { return Weekmodel.of(Locale.getDefault(Locale.Category.FORMAT)); }
@Override public Set<ChronoElement<?>> getElements( Locale locale, AttributeQuery attributes ) { return Weekmodel.of(locale).getElements(); }
/** * <p>Determines a country-specific weekend as non-business days. </p> * * @param country locale with country information * @return HolidayModel * @see Weekmodel#weekend() */ /*[deutsch] * <p>Bestimmt ein länderspezifisches Wochenende als arbeitsfreie Tage. </p> * * @param country locale with country information * @return HolidayModel * @see Weekmodel#weekend() */ static HolidayModel ofWeekend(Locale country) { return date -> date.matches(Weekmodel.of(country).weekend()); }
private Object readWeekmodel( DataInput in, byte header ) throws IOException { int data = in.readByte(); Weekday firstDayOfWeek = Weekday.valueOf(data >> 4); int minimalDaysInFirstWeek = (data & 0xF); Weekday startOfWeekend = Weekday.SATURDAY; Weekday endOfWeekend = Weekday.SUNDAY; if ((header & 0xF) == 1) { data = in.readByte(); startOfWeekend = Weekday.valueOf(data >> 4); endOfWeekend = Weekday.valueOf(data & 0xF); } return Weekmodel.of( firstDayOfWeek, minimalDaysInFirstWeek, startOfWeekend, endOfWeekend ); }
/** * <p>Does this date fall on a week-end in given country? </p> * * @param country country setting with two-letter ISO-3166-code * @return {@code true} if in given country this date is on weekend * else {@code false} * @see Weekmodel#weekend() */ /*[deutsch] * <p>Liegt das Datum im angegebenen Land an einem Wochenende? </p> * * @param country country setting with two-letter ISO-3166-code * @return {@code true} if in given country this date is on weekend * else {@code false} * @see Weekmodel#weekend() */ public boolean isWeekend(Locale country) { return this.matches(Weekmodel.of(country).weekend()); }
int fd = gc.getFirstDayOfWeek(); int firstDayOfWeek = ((fd == 1) ? 7 : (fd - 1)); return Weekmodel.of( Weekday.valueOf(firstDayOfWeek), gc.getMinimalDaysInFirstWeek());