From: Roland Häder Date: Sun, 6 Aug 2017 21:17:02 +0000 (+0200) Subject: fixed CRLF -> LF (Linux) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=35ee32924e6271e56af391f2dc20a55389bda183;p=jcontacts-business-core.git fixed CRLF -> LF (Linux) Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontactsbusiness/opening_times/dayofweek/DayOfTheWeek.java b/src/org/mxchange/jcontactsbusiness/opening_times/dayofweek/DayOfTheWeek.java index 58d985c..cfb9b15 100644 --- a/src/org/mxchange/jcontactsbusiness/opening_times/dayofweek/DayOfTheWeek.java +++ b/src/org/mxchange/jcontactsbusiness/opening_times/dayofweek/DayOfTheWeek.java @@ -1,107 +1,107 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jcontactsbusiness.opening_times.dayofweek; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -/** - * An enumeration suitable for persisting - *

- * @author Roland Häder - */ -public enum DayOfTheWeek { - SUNDAY { - @Override - public int toCalendar () { - return Calendar.SUNDAY; - } - - }, - MONDAY { - @Override - public int toCalendar () { - return Calendar.MONDAY; - } - }, - TUESDAY { - @Override - public int toCalendar () { - return Calendar.TUESDAY; - } - }, - WEDNESDAY { - @Override - public int toCalendar () { - return Calendar.WEDNESDAY; - } - }, - THURSDAY { - @Override - public int toCalendar () { - return Calendar.THURSDAY; - } - }, - FRIDAY { - @Override - public int toCalendar () { - return Calendar.FRIDAY; - } - }, - SATURDAY { - @Override - public int toCalendar () { - return Calendar.SATURDAY; - } - }; - - public abstract int toCalendar (); - - public static DayOfTheWeek fromCalendarDay (final int day) { - - for (DayOfTheWeek dayOfWeek : DayOfTheWeek.values()) { - if (dayOfWeek.toCalendar() == day) { - return dayOfWeek; - } - } - - return null; // Consider throwing IllegalArgumentException - } - - public static DayOfTheWeek getByDate (final Date date) { - Calendar calendar = GregorianCalendar.getInstance(); - calendar.setTime(date); - return fromCalendarDay(calendar.get(Calendar.DAY_OF_WEEK)); - } - - /* - * Should return the localized day of the week - */ - @Override - public String toString () { - Calendar c = new GregorianCalendar(); - c.set(Calendar.DAY_OF_WEEK, this.toCalendar()); - SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat - .getInstance(); - sdf.applyPattern("EEEEEEEEEE"); //NOI18N - - return sdf.format(c.getTime()); - } - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontactsbusiness.opening_times.dayofweek; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * An enumeration suitable for persisting + *

+ * @author Roland Häder + */ +public enum DayOfTheWeek { + SUNDAY { + @Override + public int toCalendar () { + return Calendar.SUNDAY; + } + + }, + MONDAY { + @Override + public int toCalendar () { + return Calendar.MONDAY; + } + }, + TUESDAY { + @Override + public int toCalendar () { + return Calendar.TUESDAY; + } + }, + WEDNESDAY { + @Override + public int toCalendar () { + return Calendar.WEDNESDAY; + } + }, + THURSDAY { + @Override + public int toCalendar () { + return Calendar.THURSDAY; + } + }, + FRIDAY { + @Override + public int toCalendar () { + return Calendar.FRIDAY; + } + }, + SATURDAY { + @Override + public int toCalendar () { + return Calendar.SATURDAY; + } + }; + + public abstract int toCalendar (); + + public static DayOfTheWeek fromCalendarDay (final int day) { + + for (DayOfTheWeek dayOfWeek : DayOfTheWeek.values()) { + if (dayOfWeek.toCalendar() == day) { + return dayOfWeek; + } + } + + return null; // Consider throwing IllegalArgumentException + } + + public static DayOfTheWeek getByDate (final Date date) { + Calendar calendar = GregorianCalendar.getInstance(); + calendar.setTime(date); + return fromCalendarDay(calendar.get(Calendar.DAY_OF_WEEK)); + } + + /* + * Should return the localized day of the week + */ + @Override + public String toString () { + Calendar c = new GregorianCalendar(); + c.set(Calendar.DAY_OF_WEEK, this.toCalendar()); + SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat + .getInstance(); + sdf.applyPattern("EEEEEEEEEE"); //NOI18N + + return sdf.format(c.getTime()); + } + +}