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

Method getOtherFestivals

src/main/java/com/nlf/calendar/Lunar.java:971–999  ·  view source on GitHub ↗

获取非正式的节日,有可能一天会有多个节日 @return 非正式的节日列表,如中元节

()

Source from the content-addressed store, hash-verified

969 * @return 非正式的节日列表,如中元节
970 */
971 public List<String> getOtherFestivals() {
972 List<String> l = new ArrayList<String>();
973 List<String> fs = LunarUtil.OTHER_FESTIVAL.get(month + "-" + day);
974 if (null != fs) {
975 l.addAll(fs);
976 }
977 String solarYmd = solar.toYmd();
978 if (solarYmd.equals(jieQi.get("清明").next(-1).toYmd())) {
979 l.add("寒食节");
980 }
981 Solar jq = jieQi.get("立春");
982 int offset = 4 - jq.getLunar().getDayGanIndex();
983 if (offset < 0) {
984 offset += 10;
985 }
986 if (solarYmd.equals(jq.next(offset + 40).toYmd())) {
987 l.add("春社");
988 }
989
990 jq = jieQi.get("立秋");
991 offset = 4 - jq.getLunar().getDayGanIndex();
992 if (offset < 0) {
993 offset += 10;
994 }
995 if (solarYmd.equals(jq.next(offset + 40).toYmd())) {
996 l.add("秋社");
997 }
998 return l;
999 }
1000
1001 /**
1002 * 获取彭祖百忌天干

Callers 5

test58Method · 0.95
test59Method · 0.95
test60Method · 0.95
test61Method · 0.95
toFullStringMethod · 0.95

Calls 5

getLunarMethod · 0.95
nextMethod · 0.95
toYmdMethod · 0.80
nextMethod · 0.45
getDayGanIndexMethod · 0.45

Tested by 4

test58Method · 0.76
test59Method · 0.76
test60Method · 0.76
test61Method · 0.76