📄 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.read.biff;
import common.Assert;
import common.Logger;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import jxl.*;
import jxl.biff.FormattingRecords;
import jxl.format.CellFormat;
// Referenced classes of package jxl.read.biff:
// CellFeaturesAccessor, SheetImpl, ColumnInfoRecord, RowRecord
class DateRecord
implements DateCell, CellFeaturesAccessor
{
private static Logger logger;
private Date date;
private int row;
private int column;
private boolean time;
private DateFormat format;
private CellFormat cellFormat;
private int xfIndex;
private FormattingRecords formattingRecords;
private SheetImpl sheet;
private CellFeatures features;
private boolean initialized;
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy");
private static final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
private static final int nonLeapDay = 61;
private static final TimeZone gmtZone = TimeZone.getTimeZone("GMT");
private static final int utcOffsetDays = 25569;
private static final int utcOffsetDays1904 = 24107;
private static final long secondsInADay = 0x15180L;
private static final long msInASecond = 1000L;
private static final long msInADay = 0x5265c00L;
static Class class$jxl$read$biff$DateRecord; /* synthetic field */
public DateRecord(NumberCell num, int xfi, FormattingRecords fr, boolean nf, SheetImpl si)
{
row = num.getRow();
column = num.getColumn();
xfIndex = xfi;
formattingRecords = fr;
sheet = si;
initialized = false;
format = formattingRecords.getDateFormat(xfIndex);
double numValue = num.getValue();
if(Math.abs(numValue) < 1.0D)
{
if(format == null)
format = timeFormat;
time = true;
} else
{
if(format == null)
format = dateFormat;
time = false;
}
if(!nf && !time && numValue < 61D)
numValue++;
format.setTimeZone(gmtZone);
int offsetDays = nf ? 24107 : 25569;
double utcDays = numValue - (double)offsetDays;
long utcValue = Math.round(utcDays * 86400D) * 1000L;
date = new Date(utcValue);
}
public final int getRow()
{
return row;
}
public final int getColumn()
{
return column;
}
public Date getDate()
{
return date;
}
public String getContents()
{
return format.format(date);
}
public CellType getType()
{
return CellType.DATE;
}
public boolean isTime()
{
return time;
}
public DateFormat getDateFormat()
{
Assert.verify(format != null);
return format;
}
public CellFormat getCellFormat()
{
if(!initialized)
{
cellFormat = formattingRecords.getXFRecord(xfIndex);
initialized = true;
}
return cellFormat;
}
public boolean isHidden()
{
ColumnInfoRecord cir = sheet.getColumnInfo(column);
if(cir != null && cir.getWidth() == 0)
return true;
RowRecord rr = sheet.getRowInfo(row);
return rr != null && (rr.getRowHeight() == 0 || rr.isCollapsed());
}
protected final SheetImpl getSheet()
{
return sheet;
}
public CellFeatures getCellFeatures()
{
return features;
}
public void setCellFeatures(CellFeatures cf)
{
features = cf;
}
static Class class$(String x0)
{
return Class.forName(x0);
ClassNotFoundException x1;
x1;
throw new NoClassDefFoundError(x1.getMessage());
}
static
{
logger = Logger.getLogger(class$jxl$read$biff$DateRecord != null ? class$jxl$read$biff$DateRecord : (class$jxl$read$biff$DateRecord = class$("jxl.read.biff.DateRecord")));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -