Clean Code



Download 3,58 Mb.
Pdf ko'rish
bet367/384
Sana05.04.2022
Hajmi3,58 Mb.
#530298
1   ...   363   364   365   366   367   368   369   370   ...   384
Bog'liq
Clean Code

Appendix B: 
org.jfree.date.SerialDate
Listing B-11 
WeekInMonth.java (Final)
1 package org.jfree.date;

3 public enum WeekInMonth {
4 FIRST(1), SECOND(2), THIRD(3), FOURTH(4), LAST(0);
5 private final int index;

7 WeekInMonth(int index) {
8 this.index = index;
9 }
10 
11 public int toInt() {
12 return index;
13 }
14 }


401
Appendix B: 
org.jfree.date.SerialDate
Listing B-12 
WeekdayRange.java (Final)
1 package org.jfree.date;

3 public enum WeekdayRange {
4 LAST, NEAREST, NEXT
5 }


402
Appendix B: 
org.jfree.date.SerialDate
Listing B-13 
DateUtil.java (Final)
1 package org.jfree.date;

3 import java.text.DateFormatSymbols;

5 public class DateUtil {
6 private static DateFormatSymbols dateFormatSymbols = new DateFormatSymbols();

8 public static String[] getMonthNames() {
9 return dateFormatSymbols.getMonths();
10 }
11 
12 public static boolean isLeapYear(int year) {
13 boolean fourth = year % 4 == 0;
14 boolean hundredth = year % 100 == 0;
15 boolean fourHundredth = year % 400 == 0;
16 return fourth && (!hundredth || fourHundredth);
17 }
18 
19 public static int lastDayOfMonth(Month month, int year) {
20 if (month == Month.FEBRUARY && isLeapYear(year))
21 return month.lastDay() + 1;
22 else
23 return month.lastDay();
24 }
25 
26 public static int leapYearCount(int year) {
27 int leap4 = (year - 1896) / 4;
28 int leap100 = (year - 1800) / 100;
29 int leap400 = (year - 1600) / 400;
30 return leap4 - leap100 + leap400;
31 }
32 }


403

Download 3,58 Mb.

Do'stlaringiz bilan baham:
1   ...   363   364   365   366   367   368   369   370   ...   384




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish