holidaytempdata.java
来自「一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。」· Java 代码 · 共 113 行
JAVA
113 行
package jp.co.sjts.gsession.main;
import jp.co.sjts.gsession.tools.*;
/**
* <p>媥擔僥儞僾儗乕僩僼傽僀儖偺僨乕僞 HolidayTempData
* <p>Copyright (C) 1999-2000 Japan Total System Co,LTD
*
* @author Junichi K <kaneuchi@sjts.co.jp>
*/
public class HolidayTempData implements Comparable
{
private String date;
private String title;
private String substitute;
private String year;
private int flg=0;
public String getTempDate(){
return date;
}
public String getTitle(){
return title;
}
public String getSubstitute(){
return substitute;
}
public void setTempDate(String date){
this.date = date;
}
public void setTitle(String title){
this.title = title;
}
public void setSubstitute(String substitute){
this.substitute = substitute;
}
public HolidayTempData(String date,String title,String substitute,String year){
this.date = date;
this.title = title;
this.substitute = substitute;
this.year = year;
}
public String toString(){
StringBuffer sb = new StringBuffer();
sb.append(date);
sb.append(",");
sb.append(title);
sb.append(",");
sb.append(substitute);
return new String(sb);
}
public int getFlg(){ return flg; }
/**
* 奼挘巜掕偺擔晅傪曄姺偟偨傕偺傪庢摼偡傞丅
*
* @return 曄姺惉岟帪丄傑偨偼捠忢擔晅偺応崌 : 擔晅
* 曄姺屻偺擔晅偑晄惓偩偭偨応崌 : 嬻暥帤楍("")
*/
public String getDate(){
GSDate gsDate = new GSDate();
String strMonth = date.substring(0,2);
int dDay = Integer.parseInt(date.substring(2));
//奼挘擔晅偐偳偆偐傪敾掕
if(dDay < 41)
return date;
dDay -= 30;
gsDate.setYMD(year+strMonth+"01");
int firstweek = gsDate.getWeek();
int thisweek = dDay % 10;
int weeknumber = dDay / 10;
int day = 1;
if(firstweek < thisweek)
day += thisweek - firstweek;
else if(firstweek > thisweek){
day += (7 - firstweek) + thisweek;
// weeknumber++;
}
day += 7 * (weeknumber - 1);
//擔晅偑晄惓偐偳偆偐傪敾掕
if(gsDate.getMaxDayOfMonth() < day)
flg = -1;
gsDate.setYMD(Integer.parseInt(year),Integer.parseInt(strMonth),day);
return (gsDate.getstrMonth()+gsDate.getstrDay());
}
public int compareTo(Object o){
GSDate gsDate = new GSDate();
HolidayTempData tempdata = (HolidayTempData)o;
String myMD = getDate();
String otMD = tempdata.getDate();
int order = myMD.compareTo(otMD);
if((order == 0) && (Integer.parseInt(myMD.substring(2)) > 40)) {
order = -1;
tempdata.flg=1;
this.flg=1;
}else if(order == 0){
this.flg=1;
tempdata.flg=1;
}
return order;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?