📄 daterecord.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: DateRecord.java
package jxl.write.biff;
import common.Logger;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import jxl.CellType;
import jxl.DateCell;
import jxl.biff.DoubleHelper;
import jxl.biff.Type;
import jxl.format.CellFormat;
import jxl.write.DateFormats;
import jxl.write.WritableCellFormat;
// Referenced classes of package jxl.write.biff:
// CellValue
public abstract class DateRecord extends CellValue
{
protected static final class GMTDate
{
public GMTDate()
{
}
}
private static Logger logger;
private double value;
private Date date;
private boolean time;
private static final int utcOffsetDays = 25569;
private static final long msInADay = 0x5265c00L;
static final WritableCellFormat defaultDateFormat;
private static final int nonLeapDay = 61;
static Class class$jxl$write$biff$DateRecord; /* synthetic field */
protected DateRecord(int c, int r, Date d)
{
this(c, r, d, ((CellFormat) (defaultDateFormat)), true);
}
protected DateRecord(int c, int r, Date d, GMTDate a)
{
this(c, r, d, ((CellFormat) (defaultDateFormat)), false);
}
protected DateRecord(int c, int r, Date d, CellFormat st)
{
super(Type.NUMBER, c, r, st);
date = d;
calculateValue(true);
}
protected DateRecord(int c, int r, Date d, CellFormat st, GMTDate a)
{
super(Type.NUMBER, c, r, st);
date = d;
calculateValue(false);
}
protected DateRecord(int c, int r, Date d, CellFormat st, boolean tim)
{
super(Type.NUMBER, c, r, st);
date = d;
time = tim;
calculateValue(false);
}
protected DateRecord(DateCell dc)
{
super(Type.NUMBER, dc);
date = dc.getDate();
time = dc.isTime();
calculateValue(false);
}
protected DateRecord(int c, int r, DateRecord dr)
{
super(Type.NUMBER, c, r, dr);
value = dr.value;
time = dr.time;
date = dr.date;
}
private void calculateValue(boolean adjust)
{
long zoneOffset = 0L;
long dstOffset = 0L;
if(adjust)
{
Calendar cal = Calendar.getInstance();
cal.setTime(date);
zoneOffset = cal.get(15);
dstOffset = cal.get(16);
}
long utcValue = date.getTime() + zoneOffset + dstOffset;
double utcDays = (double)utcValue / 86400000D;
value = utcDays + 25569D;
if(!time && value < 61D)
value--;
if(time)
value = value - (double)(int)value;
}
public CellType getType()
{
return CellType.DATE;
}
public byte[] getData()
{
byte celldata[] = super.getData();
byte data[] = new byte[celldata.length + 8];
System.arraycopy(celldata, 0, data, 0, celldata.length);
DoubleHelper.getIEEEBytes(value, data, celldata.length);
return data;
}
public String getContents()
{
return date.toString();
}
protected void setDate(Date d)
{
date = d;
calculateValue(true);
}
protected void setDate(Date d, GMTDate a)
{
date = d;
calculateValue(false);
}
public Date getDate()
{
return date;
}
public boolean isTime()
{
return time;
}
public DateFormat getDateFormat()
{
return null;
}
static Class class$(String x0)
{
return Class.forName(x0);
ClassNotFoundException x1;
x1;
throw new NoClassDefFoundError(x1.getMessage());
}
static
{
logger = Logger.getLogger(class$jxl$write$biff$DateRecord != null ? class$jxl$write$biff$DateRecord : (class$jxl$write$biff$DateRecord = class$("jxl.write.biff.DateRecord")));
defaultDateFormat = new WritableCellFormat(DateFormats.DEFAULT);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -