博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java中需要注意的东西_一些在JAVA中要注意的东西(3)
阅读量:6513 次
发布时间:2019-06-24

本文共 2398 字,大约阅读时间需要 7 分钟。

case 6:

solarday = getSolarTermNum("芒种");

if (solarday == d) ret = "芒种";

solarday = getSolarTermNum("夏至");

if (solarday == d) ret = "夏至";

break;

case 7:

solarday = getSolarTermNum("小暑");

if (solarday == d) ret = "小暑";

solarday = getSolarTermNum("大暑");

if (solarday == d) ret = "大暑";

break;

case 8:

solarday = getSolarTermNum("立秋");

if (solarday == d) ret = "立秋";

solarday = getSolarTermNum("处暑");

if (solarday == d) ret = "处暑";

break;

case 9:

solarday = getSolarTermNum("白露");

if (solarday == d) ret = "白露";

solarday = getSolarTermNum("秋分");

if (solarday == d) ret = "秋分";

break;

case 10:

solarday = getSolarTermNum("寒露");

if (solarday == d) ret = "寒露";

solarday = getSolarTermNum("霜降");

if (solarday == d) ret = "霜降";

break;

case 11:

solarday = getSolarTermNum("立冬");

if (solarday == d) ret = "立冬";

solarday = getSolarTermNum("小雪");

if (solarday == d) ret = "小雪";

break;

case 12:

solarday = getSolarTermNum("大雪");

if (solarday == d) ret = "大雪";

solarday = getSolarTermNum("冬至");

if (solarday == d) ret = "冬至";

break;

}

}

return ret;

}

public String toString() {

String year1 = "年";

String run1 = "闰";

String month1 = "月";

return cyclical() + animalsYear() + year1 + (leap ? run1 : "") + lunarMonthName[month - 1] + month1 + getChinaDayString(day);

}

public int getSolarTermNum(String name) {

double centuryValue = 0;

int centuryIndex = -1;

if (ye >= 1901 && ye <= 2000) {

centuryIndex = 0;

} else if (ye >= 2001 && ye <= 2100) {

centuryIndex = 1;

} else {

throw new RuntimeException("Not supported year:" + ye);

}

int i;

int ordinal = 0;

for (i = 0; i < SolarTerms.length; i++) {

if (SolarTerms[i].equals(name)) {

ordinal = i;

break;

}

}

centuryValue = CENTURY_ARRAY[centuryIndex][ordinal];

int dateNum = 0;

int y = ye % 100;

if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {

if (name == "小寒" || name == "大寒" || name == "立春" || name == "雨水") {

y = y - 1;

}

}

dateNum = (int) (y * D + centuryValue) - (int) (y / 4);

dateNum += specialYearOffset(ye, name);

return dateNum;

}

public int specialYearOffset(int year, String name) {

int offset = 0;

offset += getOffset(DECREASE_OFFSETMAP, year, name, -1);

offset += getOffset(INCREASE_OFFSETMAP, year, name, 1);

return offset;

}

public int getOffset(Map map, int year, String name, int offset) {

int off = 0;

Integer[] years = map.get(name);

if (null != years) {

for (int i : years) {

if (i == year) {

off = offset;

break;

}

}

}

return off;

}

}

转载地址:http://ixifo.baihongyu.com/

你可能感兴趣的文章
复杂度归纳--小结
查看>>
跨越企业的“中等收入陷阱”
查看>>
luogu P1280 尼克的任务 序列DP
查看>>
sys.check_constraints
查看>>
#define WIN32_LEAN_AND_MEAN 的作用
查看>>
仿余额宝数字跳动效果 TextCounter
查看>>
你必须知道的.net学习总结
查看>>
Axure8.0 网页 or App 鼠标滚动效果
查看>>
大家好,新年快乐。
查看>>
labview如何弹出提示窗口_LabVIEW开发者必读的问答汇总,搞定疑难杂症全靠它了!...
查看>>
jquery 乱码 传参_jquery获取URL中参数解决中文乱码问题的两种方法
查看>>
JDBC_MySQL_jdbc连接mysql_MySQL
查看>>
linux不能访问80端口,lunux开放80端口(本地访问不了linux文件可能是这个原因)...
查看>>
android单位转换小程序,微信小程序中rpx与rem单位转换
查看>>
ps切图教程 android,PS前端切图完整教程
查看>>
HTML如何把输入框变成必填值,required输入框为必填项
查看>>
背锅侠逆袭之路
查看>>
演示:使用协议分析器取证IPv6的报文结构
查看>>
oracle 11gr2 rac中的4种IP解说
查看>>
为什么你找不到工作?
查看>>