MCPcopy Create free account
hub / github.com/6tail/lunar-java / getFestivals

Method getFestivals

src/main/java/com/nlf/calendar/Solar.java:408–430  ·  view source on GitHub ↗

获取节日,有可能一天会有多个节日 @return 劳动节等

()

Source from the content-addressed store, hash-verified

406 * @return 劳动节等
407 */
408 public List<String> getFestivals() {
409 List<String> l = new ArrayList<String>();
410 //获取几月几日对应的节日
411 String f = SolarUtil.FESTIVAL.get(month + "-" + day);
412 if (null != f) {
413 l.add(f);
414 }
415 //计算几月第几个星期几对应的节日
416 int weeks = (int) Math.ceil(day / 7D);
417 //星期几,0代表星期天
418 int week = getWeek();
419 f = SolarUtil.WEEK_FESTIVAL.get(month + "-" + weeks + "-" + week);
420 if (null != f) {
421 l.add(f);
422 }
423 if (day + 7 > SolarUtil.getDaysOfMonth(year, month)) {
424 f = SolarUtil.WEEK_FESTIVAL.get(month + "-0-" + week);
425 if (null != f) {
426 l.add(f);
427 }
428 }
429 return l;
430 }
431
432 /**
433 * 获取非正式的节日,有可能一天会有多个节日

Callers 3

testMethod · 0.95
test11Method · 0.95
toFullStringMethod · 0.95

Calls 2

getWeekMethod · 0.95
getDaysOfMonthMethod · 0.95

Tested by 2

testMethod · 0.76
test11Method · 0.76