Sonar fixes - add cloneable interface to classes with clone()

Sonar fixes - remove pubic/static/final modifier from interfaces

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1705789 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-09-28 23:16:58 +00:00
parent 6f7f16853e
commit 1b2b506edb
111 changed files with 490 additions and 397 deletions

View File

@ -56,6 +56,8 @@ public class RecordsStresser {
assertArrayEquals("Record of type " + record.getClass() + " should return the same byte array via the clone() method, but did return a different array",
origBytes, newBytes);
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
} catch (RuntimeException e) {
// some Records do not implement clone, ignore those for now
assertTrue(e.getMessage().contains("needs to define a clone method"));
@ -70,6 +72,7 @@ public class RecordsStresser {
try {
HSSFWorkbook wb = new HSSFWorkbook(stream);
handleWorkbook(wb);
wb.close();
} finally {
stream.close();
}

View File

@ -22,7 +22,11 @@ import java.io.PrintWriter;
import java.util.Collections;
import java.util.List;
import org.apache.poi.util.*;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
/**
* The base abstract record from which all escher records are defined. Subclasses will need
@ -223,9 +227,9 @@ public abstract class EscherRecord {
/**
* Escher records may need to be clonable in the future.
*/
public Object clone()
{
throw new RuntimeException( "The class " + getClass().getName() + " needs to define a clone method" );
@Override
public EscherRecord clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException( "The class " + getClass().getName() + " needs to define a clone method" );
}
/**

View File

@ -26,12 +26,8 @@ import org.apache.poi.util.RecordFormatException;
* text in the format of the parent application, rather than in
* Escher format. We don't attempt to understand the contents, since
* they will be in the parent's format, not Escher format.
*
* @author Glen Stampoultzis (glens at apache.org)
* @author Nick Burch (nick at torchbox dot com)
*/
public class EscherTextboxRecord extends EscherRecord
{
public class EscherTextboxRecord extends EscherRecord implements Cloneable {
public static final short RECORD_ID = (short)0xF00D;
public static final String RECORD_DESCRIPTION = "msofbtClientTextbox";
@ -102,10 +98,13 @@ public class EscherTextboxRecord extends EscherRecord
return 8 + thedata.length;
}
public Object clone()
{
// shallow clone
return super.clone();
@Override
public EscherTextboxRecord clone() {
EscherTextboxRecord etr = new EscherTextboxRecord();
etr.setOptions(this.getOptions());
etr.setRecordId(this.getRecordId());
etr.thedata = this.thedata.clone();
return etr;
}
public String getRecordName() {

View File

@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndian;
* @author Glen Stampoultzis (glens at apache.org)
* @author Zhang Zhang (zhangzzh at gmail.com)
*/
public final class UnknownEscherRecord extends EscherRecord {
public final class UnknownEscherRecord extends EscherRecord implements Cloneable {
private static final byte[] NO_BYTES = new byte[0];
/** The data for this record not including the the 8 byte header */
@ -113,9 +113,13 @@ public final class UnknownEscherRecord extends EscherRecord {
_childRecords = childRecords;
}
public Object clone() {
// shallow clone
return super.clone();
@Override
public UnknownEscherRecord clone() {
UnknownEscherRecord uer = new UnknownEscherRecord();
uer.thedata = this.thedata.clone();
uer.setOptions(this.getOptions());
uer.setRecordId(this.getRecordId());
return uer;
}
public String getRecordName() {

View File

@ -487,7 +487,7 @@ public final class BiffViewer {
}
}
private static interface IBiffRecordListener {
private interface IBiffRecordListener {
void processRecord(int globalOffset, int recordCounter, int sid, int dataSize, byte[] data);

View File

@ -390,7 +390,11 @@ public final class InternalSheet {
_destList = destList;
}
public void visitRecord(Record r) {
_destList.add((Record)r.clone());
try {
_destList.add((Record)r.clone());
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
}
@ -415,8 +419,12 @@ public final class InternalSheet {
*/
rb = new DrawingRecord();
}
Record rec = (Record) ((Record) rb).clone();
clonedRecords.add(rec);
try {
Record rec = (Record) ((Record) rb).clone();
clonedRecords.add(rec);
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
return createSheet(new RecordStream(clonedRecords, 0));
}

View File

@ -36,7 +36,7 @@ import org.apache.poi.hssf.util.LazilyConcatenatedByteArray;
* @author Glen Stampoultzis (glens at apache.org)
* @author Michael Zalewski (zalewski at optonline.net)
*/
public abstract class AbstractEscherHolderRecord extends Record {
public abstract class AbstractEscherHolderRecord extends Record implements Cloneable {
private static boolean DESERIALISE;
static {
try {
@ -148,9 +148,9 @@ public abstract class AbstractEscherHolderRecord extends Record {
public abstract short getSid();
public Object clone()
{
return cloneViaReserialise();
@Override
public AbstractEscherHolderRecord clone() {
return (AbstractEscherHolderRecord)cloneViaReserialise();
}
public void addEscherRecord(int index, EscherRecord element)

View File

@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Josh Micich
*/
public final class ArrayRecord extends SharedValueRecordBase {
public final class ArrayRecord extends SharedValueRecordBase implements Cloneable {
public final static short sid = 0x0221;
private static final int OPT_ALWAYS_RECALCULATE = 0x0001;
@ -96,7 +96,8 @@ public final class ArrayRecord extends SharedValueRecordBase {
return sb.toString();
}
public Object clone() {
@Override
public ArrayRecord clone() {
ArrayRecord rec = new ArrayRecord(_formula.copy(), getRange());
// they both seem unused, but clone them nevertheless to have an exact copy

View File

@ -28,9 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Yegor Kozlov
*/
public final class AutoFilterInfoRecord
extends StandardRecord
{
public final class AutoFilterInfoRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x9D;
/**
* Number of AutoFilter drop-down arrows on the sheet
@ -93,9 +91,9 @@ public final class AutoFilterInfoRecord
}
@Override
public Object clone()
public AutoFilterInfoRecord clone()
{
return cloneViaReserialise();
return (AutoFilterInfoRecord)cloneViaReserialise();
}
}

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class BOFRecord extends StandardRecord {
public final class BOFRecord extends StandardRecord implements Cloneable {
/**
* for BIFF8 files the BOF is 0x809. For earlier versions see
* {@link #biff2_sid} {@link #biff3_sid} {@link #biff4_sid}
@ -268,7 +268,8 @@ public final class BOFRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public BOFRecord clone() {
BOFRecord rec = new BOFRecord();
rec.field_1_version = field_1_version;
rec.field_2_type = field_2_type;

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class BlankRecord extends StandardRecord implements CellValueRecordInterface {
public final class BlankRecord extends StandardRecord implements CellValueRecordInterface, Cloneable {
public final static short sid = 0x0201;
private int field_1_row;
private short field_2_col;
@ -137,7 +137,8 @@ public final class BlankRecord extends StandardRecord implements CellValueRecord
return 6;
}
public Object clone() {
@Override
public BlankRecord clone() {
BlankRecord rec = new BlankRecord();
rec.field_1_row = field_1_row;
rec.field_2_col = field_2_col;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Michael P. Harhen
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class BoolErrRecord extends CellRecord {
public final class BoolErrRecord extends CellRecord implements Cloneable {
public final static short sid = 0x0205;
private int _value;
/**
@ -169,7 +169,8 @@ public final class BoolErrRecord extends CellRecord {
return sid;
}
public Object clone() {
@Override
public BoolErrRecord clone() {
BoolErrRecord rec = new BoolErrRecord();
copyBaseFields(rec);
rec._value = _value;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.*;
*
* @author Shawn Laubach (slaubach at apache dot org)
*/
public final class BottomMarginRecord extends StandardRecord implements Margin {
public final class BottomMarginRecord extends StandardRecord implements Margin, Cloneable {
public final static short sid = 0x29;
private double field_1_margin;
@ -80,8 +80,8 @@ public final class BottomMarginRecord extends StandardRecord implements Margin {
this.field_1_margin = field_1_margin;
}
public Object clone()
{
@Override
public BottomMarginRecord clone() {
BottomMarginRecord rec = new BottomMarginRecord();
rec.field_1_margin = this.field_1_margin;
return rec;

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
* Conditional Formatting Header v12 record CFHEADER12 (0x0879),
* for conditional formattings introduced in Excel 2007 and newer.
*/
public final class CFHeader12Record extends CFHeaderBase implements FutureRecord {
public final class CFHeader12Record extends CFHeaderBase implements FutureRecord, Cloneable {
public static final short sid = 0x0879;
private FtrHeader futureHeader;
@ -79,7 +79,8 @@ public final class CFHeader12Record extends CFHeaderBase implements FutureRecord
return futureHeader.getAssociatedRange();
}
public Object clone() {
@Override
public CFHeader12Record clone() {
CFHeader12Record result = new CFHeader12Record();
result.futureHeader = (FtrHeader)futureHeader.clone();
super.copyTo(result);

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
* Parent of Conditional Formatting Header records,
* {@link CFHeaderRecord} and {@link CFHeader12Record}.
*/
public abstract class CFHeaderBase extends StandardRecord {
public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
private int field_1_numcf;
private int field_2_need_recalculation_and_id;
private CellRangeAddress field_3_enclosing_cell_range;
@ -150,4 +150,7 @@ public abstract class CFHeaderBase extends StandardRecord {
result.field_3_enclosing_cell_range = field_3_enclosing_cell_range.copy();
result.field_4_cell_ranges = field_4_cell_ranges.copy();
}
@Override
public abstract CFHeaderBase clone();
}

View File

@ -24,7 +24,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
* Used to describe a {@link CFRuleRecord}.
* @see CFHeader12Record
*/
public final class CFHeaderRecord extends CFHeaderBase {
public final class CFHeaderRecord extends CFHeaderBase implements Cloneable {
public static final short sid = 0x01B0;
/** Creates new CFHeaderRecord */
@ -47,7 +47,8 @@ public final class CFHeaderRecord extends CFHeaderBase {
return sid;
}
public Object clone() {
@Override
public CFHeaderRecord clone() {
CFHeaderRecord result = new CFHeaderRecord();
super.copyTo(result);
return result;

View File

@ -49,7 +49,7 @@ import org.apache.poi.util.POILogger;
* {@link #CONDITION_TYPE_CELL_VALUE_IS} or {@link #CONDITION_TYPE_FORMULA},
* this is only used for the other types
*/
public final class CFRule12Record extends CFRuleBase implements FutureRecord {
public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cloneable {
public static final short sid = 0x087A;
private FtrHeader futureHeader;
@ -409,7 +409,8 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord {
return buffer.toString();
}
public Object clone() {
@Override
public CFRule12Record clone() {
CFRule12Record rec = new CFRule12Record(getConditionType(), getComparisonOperation());
rec.futureHeader.setAssociatedRange(futureHeader.getAssociatedRange().copy());

View File

@ -39,7 +39,7 @@ import org.apache.poi.util.POILogger;
* new-style (Excel 2007+) also make use of {@link CFRule12Record}
* and {@link CFExRuleRecord} for their rules.
*/
public abstract class CFRuleBase extends StandardRecord {
public abstract class CFRuleBase extends StandardRecord implements Cloneable {
public static final class ComparisonOperator {
public static final byte NO_COMPARISON = 0;
public static final byte BETWEEN = 1;
@ -452,4 +452,7 @@ public abstract class CFRuleBase extends StandardRecord {
rec.setFormula1(getFormula1().copy());
rec.setFormula2(getFormula2().copy());
}
@Override
public abstract CFRuleBase clone();
}

View File

@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput;
* new-style (Excel 2007+) also make use of {@link CFRule12Record}
* and {@link CFExRuleRecord} for their rules.
*/
public final class CFRuleRecord extends CFRuleBase {
public final class CFRuleRecord extends CFRuleBase implements Cloneable {
public static final short sid = 0x01B1;
/** Creates new CFRuleRecord */
@ -139,7 +139,8 @@ public final class CFRuleRecord extends CFRuleBase {
return buffer.toString();
}
public Object clone() {
@Override
public CFRuleRecord clone() {
CFRuleRecord rec = new CFRuleRecord(getConditionType(), getComparisonOperation());
super.copyTo(rec);
return rec;

View File

@ -33,9 +33,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @see org.apache.poi.hssf.record.CalcModeRecord
*/
public final class CalcCountRecord
extends StandardRecord
{
public final class CalcCountRecord extends StandardRecord implements Cloneable {
public final static short sid = 0xC;
private short field_1_iterations;
@ -92,7 +90,8 @@ public final class CalcCountRecord
return sid;
}
public Object clone() {
@Override
public CalcCountRecord clone() {
CalcCountRecord rec = new CalcCountRecord();
rec.field_1_iterations = field_1_iterations;
return rec;

View File

@ -33,9 +33,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @see org.apache.poi.hssf.record.CalcCountRecord
*/
public final class CalcModeRecord
extends StandardRecord
{
public final class CalcModeRecord extends StandardRecord implements Cloneable {
public final static short sid = 0xD;
/**
@ -120,7 +118,8 @@ public final class CalcModeRecord
return sid;
}
public Object clone() {
@Override
public CalcModeRecord clone() {
CalcModeRecord rec = new CalcModeRecord();
rec.field_1_calcmode = field_1_calcmode;
return rec;

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.BitFieldFactory;
* REFERENCE: PG 293 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
public final class ColumnInfoRecord extends StandardRecord {
public final class ColumnInfoRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x007D;
private int _firstCol;
@ -244,7 +244,8 @@ public final class ColumnInfoRecord extends StandardRecord {
return sb.toString();
}
public Object clone() {
@Override
public ColumnInfoRecord clone() {
ColumnInfoRecord rec = new ColumnInfoRecord();
rec._firstCol = _firstCol;
rec._lastCol = _lastCol;

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class CommonObjectDataSubRecord extends SubRecord {
public final class CommonObjectDataSubRecord extends SubRecord implements Cloneable {
public final static short sid = 0x0015;
private static final BitField locked = BitFieldFactory.getInstance(0x0001);
@ -153,7 +153,8 @@ public final class CommonObjectDataSubRecord extends SubRecord {
return sid;
}
public Object clone() {
@Override
public CommonObjectDataSubRecord clone() {
CommonObjectDataSubRecord rec = new CommonObjectDataSubRecord();
rec.field_1_objectType = field_1_objectType;

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Csaba Nagy (ncsaba at yahoo dot com)
*/
public final class ContinueRecord extends StandardRecord {
public final class ContinueRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x003C;
private byte[] _data;
@ -69,7 +69,8 @@ public final class ContinueRecord extends StandardRecord {
_data = in.readRemainder();
}
public Object clone() {
@Override
public ContinueRecord clone() {
return new ContinueRecord(_data);
}
}

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height
*/
public final class DBCellRecord extends StandardRecord {
public final class DBCellRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x00D7;
public final static int BLOCK_SIZE = 32;
@ -116,7 +116,8 @@ public final class DBCellRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public DBCellRecord clone() {
// safe because immutable
return this;
}

View File

@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndianOutput;
* This record is the list header of all data validation records (0x01BE) in the current sheet.
* @author Dragos Buleandra (dragos.buleandra@trade2b.ro)
*/
public final class DVALRecord extends StandardRecord {
public final class DVALRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x01B2;
/** Options of the DVAL */
@ -159,7 +159,8 @@ public final class DVALRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public DVALRecord clone() {
DVALRecord rec = new DVALRecord();
rec.field_1_options = field_1_options;
rec.field_2_horiz_pos = field_2_horiz_pos;

View File

@ -36,7 +36,7 @@ import org.apache.poi.util.StringUtil;
* @author Dragos Buleandra (dragos.buleandra@trade2b.ro)
* @author Josh Micich
*/
public final class DVRecord extends StandardRecord {
public final class DVRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x01BE;
/** the unicode string used for error/prompt title/text when not present */
@ -345,7 +345,8 @@ public final class DVRecord extends StandardRecord {
* Clones the object. Uses serialisation, as the
* contents are somewhat complex
*/
public Object clone() {
return cloneViaReserialise();
@Override
public DVRecord clone() {
return (DVRecord)cloneViaReserialise();
}
}

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class DefaultColWidthRecord extends StandardRecord {
public final class DefaultColWidthRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x0055;
private int field_1_col_width;
@ -91,7 +91,8 @@ public final class DefaultColWidthRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public DefaultColWidthRecord clone() {
DefaultColWidthRecord rec = new DefaultColWidthRecord();
rec.field_1_col_width = field_1_col_width;
return rec;

View File

@ -31,9 +31,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @version 2.0-pre
*/
public final class DefaultRowHeightRecord
extends StandardRecord
{
public final class DefaultRowHeightRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x225;
private short field_1_option_flags;
private short field_2_row_height;
@ -122,7 +120,8 @@ public final class DefaultRowHeightRecord
return sid;
}
public Object clone() {
@Override
public DefaultRowHeightRecord clone() {
DefaultRowHeightRecord rec = new DefaultRowHeightRecord();
rec.field_1_option_flags = field_1_option_flags;
rec.field_2_row_height = field_2_row_height;

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class DeltaRecord extends StandardRecord {
public final class DeltaRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x0010;
public final static double DEFAULT_VALUE = 0.0010; // should be .001
@ -71,7 +71,8 @@ public final class DeltaRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public DeltaRecord clone() {
// immutable
return this;
}

View File

@ -31,9 +31,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @version 2.0-pre
*/
public final class DimensionsRecord
extends StandardRecord
{
public final class DimensionsRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x200;
private int field_1_first_row;
private int field_2_last_row; // plus 1
@ -170,7 +168,8 @@ public final class DimensionsRecord
return sid;
}
public Object clone() {
@Override
public DimensionsRecord clone() {
DimensionsRecord rec = new DimensionsRecord();
rec.field_1_first_row = field_1_first_row;
rec.field_2_last_row = field_2_last_row;

View File

@ -21,7 +21,7 @@ import org.apache.poi.util.LittleEndianOutput;
/**
* DrawingRecord (0x00EC)<p/>
*/
public final class DrawingRecord extends StandardRecord {
public final class DrawingRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x00EC;
private static final byte[] EMPTY_BYTE_ARRAY = {};
@ -75,7 +75,8 @@ public final class DrawingRecord extends StandardRecord {
* Cloning of drawing records must be executed through HSSFPatriarch, because all id's must be changed
* @return cloned drawing records
*/
public Object clone() {
@Override
public DrawingRecord clone() {
DrawingRecord rec = new DrawingRecord();
rec.recordData = recordData.clone();
if (contd != null) {

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Josh Micich
*/
public final class DrawingSelectionRecord extends StandardRecord {
public final class DrawingSelectionRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x00ED;
/**
@ -110,7 +110,8 @@ public final class DrawingSelectionRecord extends StandardRecord {
}
}
public Object clone() {
@Override
public DrawingSelectionRecord clone() {
// currently immutable
return this;
}

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class EOFRecord extends StandardRecord {
public final class EOFRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x0A;
public static final int ENCODED_SIZE = 4;
@ -67,7 +67,8 @@ public final class EOFRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public EOFRecord clone() {
return instance;
}
}

View File

@ -40,7 +40,7 @@ import org.apache.poi.util.StringUtil;
*
* @author Daniel Noll
*/
public final class EmbeddedObjectRefSubRecord extends SubRecord {
public final class EmbeddedObjectRefSubRecord extends SubRecord implements Cloneable {
private static POILogger logger = POILogFactory.getLogger(EmbeddedObjectRefSubRecord.class);
public static final short sid = 0x0009;
@ -305,7 +305,8 @@ public final class EmbeddedObjectRefSubRecord extends SubRecord {
return field_6_unknown;
}
public Object clone() {
@Override
public EmbeddedObjectRefSubRecord clone() {
return this; // TODO proper clone
}

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class EndSubRecord extends SubRecord {
public final class EndSubRecord extends SubRecord implements Cloneable {
public final static short sid = 0x0000; // Note - zero sid is somewhat unusual (compared to plain Records)
private static final int ENCODED_SIZE = 0;
@ -75,7 +75,8 @@ public final class EndSubRecord extends SubRecord {
return sid;
}
public Object clone() {
@Override
public EndSubRecord clone() {
EndSubRecord rec = new EndSubRecord();
return rec;

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
* The collection of data (Globals Substream ABNF, macro sheet substream
* ABNF or worksheet substream ABNF) specifies Shared Feature data.
*/
public final class FeatHdrRecord extends StandardRecord {
public final class FeatHdrRecord extends StandardRecord implements Cloneable {
/**
* Specifies the enhanced protection type. Used to protect a
* shared workbook by restricting access to some areas of it
@ -106,9 +106,10 @@ public final class FeatHdrRecord extends StandardRecord {
return 12 + 2+1+4+rgbHdrData.length;
}
//HACK: do a "cheat" clone, see Record.java for more information
public Object clone() {
return cloneViaReserialise();
@Override
public FeatHdrRecord clone() {
//HACK: do a "cheat" clone, see Record.java for more information
return (FeatHdrRecord)cloneViaReserialise();
}

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.POILogger;
* This record specifies Shared Features data. It is normally paired
* up with a {@link FeatHdrRecord}.
*/
public final class FeatRecord extends StandardRecord {
public final class FeatRecord extends StandardRecord implements Cloneable {
private static POILogger logger = POILogFactory.getLogger(FeatRecord.class);
public final static short sid = 0x0868;
// SIDs from newer versions
@ -175,9 +175,10 @@ public final class FeatRecord extends StandardRecord {
}
//HACK: do a "cheat" clone, see Record.java for more information
public Object clone() {
return cloneViaReserialise();
@Override
public FeatRecord clone() {
//HACK: do a "cheat" clone, see Record.java for more information
return (FeatRecord)cloneViaReserialise();
}

View File

@ -28,17 +28,20 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class FilePassRecord extends StandardRecord {
public final static short sid = 0x002F;
public final class FilePassRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x002F;
private static final int ENCRYPTION_XOR = 0;
private static final int ENCRYPTION_OTHER = 1;
private int _encryptionType;
private KeyData _keyData;
private static interface KeyData {
private static interface KeyData extends Cloneable {
void read(RecordInputStream in);
void serialize(LittleEndianOutput out);
int getDataSize();
void appendToString(StringBuffer buffer);
KeyData clone();
}
public static class Rc4KeyData implements KeyData {
@ -119,6 +122,17 @@ public final class FilePassRecord extends StandardRecord {
buffer.append(" .rc4.verifier = ").append(HexDump.toHex(_encryptedVerifier)).append("\n");
buffer.append(" .rc4.verifierHash = ").append(HexDump.toHex(_encryptedVerifierHash)).append("\n");
}
@Override
public Rc4KeyData clone() {
Rc4KeyData other = new Rc4KeyData();
other._salt = this._salt.clone();
other._encryptedVerifier = this._encryptedVerifier.clone();
other._encryptedVerifierHash = this._encryptedVerifierHash.clone();
other._encryptionInfo = this._encryptionInfo;
other._minorVersionNo = this._minorVersionNo;
return other;
}
}
public static class XorKeyData implements KeyData {
@ -170,12 +184,22 @@ public final class FilePassRecord extends StandardRecord {
buffer.append(" .xor.key = ").append(HexDump.intToHex(_key)).append("\n");
buffer.append(" .xor.verifier = ").append(HexDump.intToHex(_verifier)).append("\n");
}
@Override
public XorKeyData clone() {
XorKeyData other = new XorKeyData();
other._key = this._key;
other._verifier = this._verifier;
return other;
}
}
private static final int ENCRYPTION_XOR = 0;
private static final int ENCRYPTION_OTHER = 1;
private FilePassRecord(FilePassRecord other) {
_encryptionType = other._encryptionType;
_keyData = other._keyData.clone();
}
public FilePassRecord(RecordInputStream in) {
_encryptionType = in.readUShort();
@ -282,9 +306,9 @@ public final class FilePassRecord extends StandardRecord {
return sid;
}
public Object clone() {
// currently immutable
return this;
@Override
public FilePassRecord clone() {
return new FilePassRecord(this);
}
public String toString() {

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.StringUtil;
* REFERENCE: PG 314 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
public final class FileSharingRecord extends StandardRecord {
public final class FileSharingRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x005B;
private short field_1_readonly;
@ -137,10 +137,8 @@ public final class FileSharingRecord extends StandardRecord {
return sid;
}
/**
* Clone this record.
*/
public Object clone() {
@Override
public FileSharingRecord clone() {
FileSharingRecord clone = new FileSharingRecord();
clone.setReadOnly(field_1_readonly);
clone.setPassword(field_2_password);

View File

@ -26,7 +26,7 @@ package org.apache.poi.hssf.record;
* @author Jason Height (jheight at chariot dot net dot au)
*
*/
public final class FooterRecord extends HeaderFooterBase {
public final class FooterRecord extends HeaderFooterBase implements Cloneable {
public final static short sid = 0x0015;
public FooterRecord(String text) {
@ -50,7 +50,8 @@ public final class FooterRecord extends HeaderFooterBase {
return sid;
}
public Object clone() {
@Override
public FooterRecord clone() {
return new FooterRecord(getText());
}
}

View File

@ -29,13 +29,19 @@ import org.apache.poi.util.StringUtil;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Shawn M. Laubach (slaubach at apache dot org)
*/
public final class FormatRecord extends StandardRecord {
public final class FormatRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x041E;
private final int field_1_index_code;
private final boolean field_3_hasMultibyte;
private final String field_4_formatstring;
private FormatRecord(FormatRecord other) {
field_1_index_code = other.field_1_index_code;
field_3_hasMultibyte = other.field_3_hasMultibyte;
field_4_formatstring = other.field_4_formatstring;
}
public FormatRecord(int indexCode, String fs) {
field_1_index_code = indexCode;
field_4_formatstring = fs;
@ -104,9 +110,9 @@ public final class FormatRecord extends StandardRecord {
public short getSid() {
return sid;
}
@Override
public Object clone() {
// immutable
return this;
public FormatRecord clone() {
return new FormatRecord(this);
}
}

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class FormulaRecord extends CellRecord {
public final class FormulaRecord extends CellRecord implements Cloneable {
public static final short sid = 0x0006; // docs say 406...because of a bug Microsoft support site article #Q184647)
private static int FIXED_SIZE = 14; // double + short + int
@ -375,7 +375,7 @@ public final class FormulaRecord extends CellRecord {
}
@Override
public Object clone() {
public FormulaRecord clone() {
FormulaRecord rec = new FormulaRecord();
copyBaseFields(rec);
rec.field_4_value = field_4_value;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Yegor Kozlov
*/
public final class FtCblsSubRecord extends SubRecord {
public final class FtCblsSubRecord extends SubRecord implements Cloneable {
public final static short sid = 0x0C;
private static final int ENCODED_SIZE = 20;
@ -90,7 +90,8 @@ public final class FtCblsSubRecord extends SubRecord {
return sid;
}
public Object clone() {
@Override
public FtCblsSubRecord clone() {
FtCblsSubRecord rec = new FtCblsSubRecord();
byte[] recdata = new byte[reserved.length];
System.arraycopy(reserved, 0, recdata, 0, recdata.length);

View File

@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndianOutput;
/**
* The FtCf structure specifies the clipboard format of the picture-type Obj record containing this FtCf.
*/
public final class FtCfSubRecord extends SubRecord {
public final class FtCfSubRecord extends SubRecord implements Cloneable {
public final static short sid = 0x07;
public final static short length = 0x02;
@ -97,7 +97,8 @@ public final class FtCfSubRecord extends SubRecord {
return sid;
}
public Object clone() {
@Override
public FtCfSubRecord clone() {
FtCfSubRecord rec = new FtCfSubRecord();
rec.flags = this.flags;
return rec;

View File

@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndianOutput;
/**
* This structure appears as part of an Obj record that represents image display properties.
*/
public final class FtPioGrbitSubRecord extends SubRecord {
public final class FtPioGrbitSubRecord extends SubRecord implements Cloneable {
public final static short sid = 0x08;
public final static short length = 0x02;
@ -151,7 +151,8 @@ public final class FtPioGrbitSubRecord extends SubRecord {
return sid;
}
public Object clone() {
@Override
public FtPioGrbitSubRecord clone() {
FtPioGrbitSubRecord rec = new FtPioGrbitSubRecord();
rec.flags = this.flags;
return rec;

View File

@ -34,9 +34,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @version 2.0-pre
*/
public final class GridsetRecord
extends StandardRecord
{
public final class GridsetRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x82;
public short field_1_gridset_flag;
@ -102,7 +100,8 @@ public final class GridsetRecord
return sid;
}
public Object clone() {
@Override
public GridsetRecord clone() {
GridsetRecord rec = new GridsetRecord();
rec.field_1_gridset_flag = field_1_gridset_flag;
return rec;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class GroupMarkerSubRecord extends SubRecord {
public final class GroupMarkerSubRecord extends SubRecord implements Cloneable {
public final static short sid = 0x0006;
private static final byte[] EMPTY_BYTE_ARRAY = { };
@ -70,7 +70,8 @@ public final class GroupMarkerSubRecord extends SubRecord {
return sid;
}
public Object clone() {
@Override
public GroupMarkerSubRecord clone() {
GroupMarkerSubRecord rec = new GroupMarkerSubRecord();
rec.reserved = new byte[reserved.length];
for ( int i = 0; i < reserved.length; i++ )

View File

@ -30,9 +30,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @version 2.0-pre
*/
public final class GutsRecord
extends StandardRecord
{
public final class GutsRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x80;
private short field_1_left_row_gutter; // size of the row gutter to the left of the rows
private short field_2_top_col_gutter; // size of the column gutter above the columns
@ -172,7 +170,8 @@ public final class GutsRecord
return sid;
}
public Object clone() {
@Override
public GutsRecord clone() {
GutsRecord rec = new GutsRecord();
rec.field_1_left_row_gutter = field_1_left_row_gutter;
rec.field_2_top_col_gutter = field_2_top_col_gutter;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class HCenterRecord extends StandardRecord {
public final class HCenterRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x0083;
private short field_1_hcenter;
@ -91,7 +91,8 @@ public final class HCenterRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public HCenterRecord clone() {
HCenterRecord rec = new HCenterRecord();
rec.field_1_hcenter = field_1_hcenter;
return rec;

View File

@ -28,7 +28,7 @@ import java.util.Locale;
*
* @author Yegor Kozlov
*/
public final class HeaderFooterRecord extends StandardRecord {
public final class HeaderFooterRecord extends StandardRecord implements Cloneable {
private static final byte[] BLANK_GUID = new byte[16];
@ -95,9 +95,10 @@ public final class HeaderFooterRecord extends StandardRecord {
return sb.toString();
}
//HACK: do a "cheat" clone, see Record.java for more information
public Object clone() {
return cloneViaReserialise();
@Override
public HeaderFooterRecord clone() {
//HACK: do a "cheat" clone, see Record.java for more information
return (HeaderFooterRecord)cloneViaReserialise();
}

View File

@ -25,7 +25,7 @@ package org.apache.poi.hssf.record;
* @author Shawn Laubach (slaubach at apache dot org) Modified 3/14/02
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class HeaderRecord extends HeaderFooterBase {
public final class HeaderRecord extends HeaderFooterBase implements Cloneable {
public final static short sid = 0x0014;
public HeaderRecord(String text) {
@ -49,7 +49,8 @@ public final class HeaderRecord extends HeaderFooterBase {
return sid;
}
public Object clone() {
@Override
public HeaderRecord clone() {
return new HeaderRecord(getText());
}
}

View File

@ -25,7 +25,7 @@ import java.util.Iterator;
* @see PageBreakRecord
* @author Danny Mui (dmui at apache dot org)
*/
public final class HorizontalPageBreakRecord extends PageBreakRecord {
public final class HorizontalPageBreakRecord extends PageBreakRecord implements Cloneable {
public static final short sid = 0x001B;
@ -48,7 +48,8 @@ public final class HorizontalPageBreakRecord extends PageBreakRecord {
return sid;
}
public Object clone() {
@Override
public PageBreakRecord clone() {
PageBreakRecord result = new HorizontalPageBreakRecord();
Iterator<Break> iterator = getBreaksIterator();
while (iterator.hasNext()) {

View File

@ -36,7 +36,7 @@ import org.apache.poi.util.StringUtil;
* from the Excel-97 format.
* Supports only external links for now (eg http://)
*/
public final class HyperlinkRecord extends StandardRecord {
public final class HyperlinkRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x01B8;
private static POILogger logger = POILogFactory.getLogger(HyperlinkRecord.class);
@ -743,7 +743,8 @@ public final class HyperlinkRecord extends StandardRecord {
setTextMark("");
}
public Object clone() {
@Override
public HyperlinkRecord clone() {
HyperlinkRecord rec = new HyperlinkRecord();
rec._range = _range.copy();
rec._guid = _guid;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class IndexRecord extends StandardRecord {
public class IndexRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x020B;
private int field_2_first_row; // first row on the sheet
private int field_3_last_row_add1; // last row
@ -149,7 +149,8 @@ public class IndexRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public IndexRecord clone() {
IndexRecord rec = new IndexRecord();
rec.field_2_first_row = field_2_first_row;
rec.field_3_last_row_add1 = field_3_last_row_add1;

View File

@ -32,7 +32,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class IterationRecord extends StandardRecord {
public final class IterationRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x0011;
private static final BitField iterationOn = BitFieldFactory.getInstance(0x0001);
@ -86,7 +86,8 @@ public final class IterationRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public IterationRecord clone() {
return new IterationRecord(getIteration());
}
}

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.POILogger;
*
* @see org.apache.poi.hssf.record.LabelSSTRecord
*/
public final class LabelRecord extends Record implements CellValueRecordInterface {
public final class LabelRecord extends Record implements CellValueRecordInterface, Cloneable {
private final static POILogger logger = POILogFactory.getLogger(LabelRecord.class);
public final static short sid = 0x0204;
@ -170,7 +170,8 @@ public final class LabelRecord extends Record implements CellValueRecordInterfac
{
}
public Object clone() {
@Override
public LabelRecord clone() {
LabelRecord rec = new LabelRecord();
rec.field_1_row = field_1_row;
rec.field_2_column = field_2_column;

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
* value. <P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
*/
public final class LabelSSTRecord extends CellRecord {
public final class LabelSSTRecord extends CellRecord implements Cloneable {
public final static short sid = 0xfd;
private int field_4_sst_index;
@ -84,7 +84,8 @@ public final class LabelSSTRecord extends CellRecord {
return sid;
}
public Object clone() {
@Override
public LabelSSTRecord clone() {
LabelSSTRecord rec = new LabelSSTRecord();
copyBaseFields(rec);
rec.field_4_sst_index = field_4_sst_index;

View File

@ -258,7 +258,8 @@ public class LbsDataSubRecord extends SubRecord {
}
@Override
public Object clone() {
public LbsDataSubRecord clone() {
// TODO: is immutable ???
return this;
}

View File

@ -24,8 +24,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Shawn Laubach (slaubach at apache dot org)
*/
public final class LeftMarginRecord extends StandardRecord implements Margin
{
public final class LeftMarginRecord extends StandardRecord implements Margin, Cloneable {
public final static short sid = 0x0026;
private double field_1_margin;
@ -72,10 +71,10 @@ public final class LeftMarginRecord extends StandardRecord implements Margin
this.field_1_margin = field_1_margin;
}
public Object clone()
{
@Override
public LeftMarginRecord clone() {
LeftMarginRecord rec = new LeftMarginRecord();
rec.field_1_margin = this.field_1_margin;
return rec;
}
} // END OF
}

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
* Description: Optional record defining a square area of cells to "merged" into one cell. <br>
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
public final class MergeCellsRecord extends StandardRecord {
public final class MergeCellsRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x00E5;
/** sometimes the regions array is shared with other MergedCellsRecords */
private CellRangeAddress[] _regions;
@ -102,7 +102,8 @@ public final class MergeCellsRecord extends StandardRecord {
return retval.toString();
}
public Object clone() {
@Override
public MergeCellsRecord clone() {
int nRegions = _numberOfRegions;
CellRangeAddress[] clonedRegions = new CellRangeAddress[nRegions];
for (int i = 0; i < clonedRegions.length; i++) {

View File

@ -135,7 +135,7 @@ public final class MulBlankRecord extends StandardRecord {
}
@Override
public Object clone() {
public MulBlankRecord clone() {
// immutable - so OK to return this
return this;
}

View File

@ -25,7 +25,7 @@ import org.apache.poi.util.StringUtil;
*
* @author Yegor Kozlov
*/
public final class NoteRecord extends StandardRecord {
public final class NoteRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x001C;
public static final NoteRecord[] EMPTY_ARRAY = { };
@ -235,7 +235,8 @@ public final class NoteRecord extends StandardRecord {
field_5_hasMultibyte = StringUtil.hasMultibyte(author);
}
public Object clone() {
@Override
public NoteRecord clone() {
NoteRecord rec = new NoteRecord();
rec.field_1_row = field_1_row;
rec.field_2_col = field_2_col;

View File

@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Yegor Kozlov
*/
public final class NoteStructureSubRecord extends SubRecord {
public final class NoteStructureSubRecord extends SubRecord implements Cloneable {
public final static short sid = 0x0D;
private static final int ENCODED_SIZE = 22;
@ -98,7 +98,8 @@ public final class NoteStructureSubRecord extends SubRecord {
return sid;
}
public Object clone() {
@Override
public NoteStructureSubRecord clone() {
NoteStructureSubRecord rec = new NoteStructureSubRecord();
byte[] recdata = new byte[reserved.length];
System.arraycopy(reserved, 0, recdata, 0, recdata.length);

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class NumberRecord extends CellRecord {
public final class NumberRecord extends CellRecord implements Cloneable {
public static final short sid = 0x0203;
private double field_4_value;
@ -87,7 +87,7 @@ public final class NumberRecord extends CellRecord {
}
@Override
public Object clone() {
public NumberRecord clone() {
NumberRecord rec = new NumberRecord();
copyBaseFields(rec);
rec.field_4_value = field_4_value;

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.LittleEndianInputStream;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class ObjRecord extends Record {
public final class ObjRecord extends Record implements Cloneable {
public final static short sid = 0x005D;
private static final int NORMAL_PAD_ALIGNMENT = 2;
@ -222,7 +222,7 @@ public final class ObjRecord extends Record {
}
@Override
public Object clone() {
public ObjRecord clone() {
ObjRecord rec = new ObjRecord();
for (int i = 0; i < subrecords.size(); i++) {

View File

@ -31,9 +31,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
public final class ObjectProtectRecord
extends StandardRecord
{
public final class ObjectProtectRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x63;
private short field_1_protect;
@ -97,7 +95,8 @@ public final class ObjectProtectRecord
return sid;
}
public Object clone() {
@Override
public ObjectProtectRecord clone() {
ObjectProtectRecord rec = new ObjectProtectRecord();
rec.field_1_protect = field_1_protect;
return rec;

View File

@ -61,16 +61,8 @@ public abstract class Record extends RecordBase {
public abstract short getSid();
@Override
public Object clone() {
// if (false) {
// // TODO - implement clone in a more standardised way
// try {
// return super.clone();
// } catch (CloneNotSupportedException e) {
// throw new RuntimeException(e);
// }
// }
throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method");
public Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException("The class "+getClass().getName()+" needs to define a clone method");
}
/**

View File

@ -28,7 +28,7 @@ import org.apache.poi.hssf.record.ColumnInfoRecord;
/**
* @author Glen Stampoultzis
*/
public final class ColumnInfoRecordsAggregate extends RecordAggregate {
public final class ColumnInfoRecordsAggregate extends RecordAggregate implements Cloneable {
/**
* List of {@link ColumnInfoRecord}s assumed to be in order
*/
@ -75,14 +75,11 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate {
}
}
/**
* Performs a deep clone of the record
*/
public Object clone() {
@Override
public ColumnInfoRecordsAggregate clone() {
ColumnInfoRecordsAggregate rec = new ColumnInfoRecordsAggregate();
for (int k = 0; k < records.size(); k++) {
ColumnInfoRecord ci = records.get(k);
rec.records.add((ColumnInfoRecord) ci.clone());
for (ColumnInfoRecord ci : records) {
rec.records.add(ci.clone());
}
return rec;
}
@ -295,7 +292,7 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate {
}
private static ColumnInfoRecord copyColInfo(ColumnInfoRecord ci) {
return (ColumnInfoRecord) ci.clone();
return ci.clone();
}

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
/**
* Border Formatting Block of the Conditional Formatting Rule Record.
*/
public final class BorderFormatting {
public final class BorderFormatting implements Cloneable {
/** No border */
public final static short BORDER_NONE = 0x0;
/** Thin border */
@ -446,7 +446,8 @@ public final class BorderFormatting {
return buffer.toString();
}
public Object clone() {
@Override
public BorderFormatting clone() {
BorderFormatting rec = new BorderFormatting();
rec.field_13_border_styles1 = field_13_border_styles1;
rec.field_14_border_styles2 = field_14_border_styles2;

View File

@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianOutput;
* Color Gradient / Color Scale specific Threshold / value (CFVO),
* for changes in Conditional Formatting
*/
public final class ColorGradientThreshold extends Threshold {
public final class ColorGradientThreshold extends Threshold implements Cloneable {
private double position;
public ColorGradientThreshold() {
@ -49,7 +49,8 @@ public final class ColorGradientThreshold extends Threshold {
return super.getDataLength() + 8;
}
public Object clone() {
@Override
public ColorGradientThreshold clone() {
ColorGradientThreshold rec = new ColorGradientThreshold();
super.copyTo(rec);
rec.position = position;

View File

@ -23,7 +23,7 @@ import org.apache.poi.util.LittleEndianInput;
* Data Bar specific Threshold / value (CFVO),
* for changes in Conditional Formatting
*/
public final class DataBarThreshold extends Threshold {
public final class DataBarThreshold extends Threshold implements Cloneable {
public DataBarThreshold() {
super();
}
@ -33,7 +33,8 @@ public final class DataBarThreshold extends Threshold {
super(in);
}
public Object clone() {
@Override
public DataBarThreshold clone() {
DataBarThreshold rec = new DataBarThreshold();
super.copyTo(rec);
return rec;

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndian;
/**
* Font Formatting Block of the Conditional Formatting Rule Record.
*/
public final class FontFormatting {
public final class FontFormatting implements Cloneable {
private byte[] _rawData;
private static final int OFFSET_FONT_NAME = 0;
@ -541,7 +541,8 @@ public final class FontFormatting {
return buffer.toString();
}
public Object clone()
@Override
public FontFormatting clone()
{
byte[] rawData = _rawData.clone();
return new FontFormatting(rawData);

View File

@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianOutput;
* Icon / Multi-State specific Threshold / value (CFVO),
* for changes in Conditional Formatting
*/
public final class IconMultiStateThreshold extends Threshold {
public final class IconMultiStateThreshold extends Threshold implements Cloneable {
/**
* Cell values that are equal to the threshold value do not pass the threshold
*/
@ -60,7 +60,8 @@ public final class IconMultiStateThreshold extends Threshold {
return super.getDataLength() + 5;
}
public Object clone() {
@Override
public IconMultiStateThreshold clone() {
IconMultiStateThreshold rec = new IconMultiStateThreshold();
super.copyTo(rec);
rec.equals = equals;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class AreaFormatRecord extends StandardRecord {
public final class AreaFormatRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x100A;
private static final BitField automatic = BitFieldFactory.getInstance(0x1);
@ -113,7 +113,8 @@ public final class AreaFormatRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public AreaFormatRecord clone() {
AreaFormatRecord rec = new AreaFormatRecord();
rec.field_1_foregroundColor = field_1_foregroundColor;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class AreaRecord extends StandardRecord {
public final class AreaRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x101A;
private short field_1_formatFlags;
private static final BitField stacked = BitFieldFactory.getInstance(0x1);
@ -78,7 +78,8 @@ public final class AreaRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public AreaRecord clone() {
AreaRecord rec = new AreaRecord();
rec.field_1_formatFlags = field_1_formatFlags;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class AxisLineFormatRecord extends StandardRecord {
public final class AxisLineFormatRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1021;
private short field_1_axisType;
public final static short AXIS_TYPE_AXIS_LINE = 0;
@ -73,7 +73,8 @@ public final class AxisLineFormatRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public AxisLineFormatRecord clone() {
AxisLineFormatRecord rec = new AxisLineFormatRecord();
rec.field_1_axisType = field_1_axisType;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Andrew C. Oliver(acoliver at apache.org)
*/
public final class AxisOptionsRecord extends StandardRecord {
public final class AxisOptionsRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1062;
private static final BitField defaultMinimum = BitFieldFactory.getInstance(0x01);
@ -145,7 +145,8 @@ public final class AxisOptionsRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public AxisOptionsRecord clone() {
AxisOptionsRecord rec = new AxisOptionsRecord();
rec.field_1_minimumCategory = field_1_minimumCategory;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class AxisParentRecord extends StandardRecord {
public final class AxisParentRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1041;
private short field_1_axisType;
public final static short AXIS_TYPE_MAIN = 0;
@ -99,7 +99,8 @@ public final class AxisParentRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public AxisParentRecord clone() {
AxisParentRecord rec = new AxisParentRecord();
rec.field_1_axisType = field_1_axisType;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class AxisRecord extends StandardRecord {
public final class AxisRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x101d;
private short field_1_axisType;
public final static short AXIS_TYPE_CATEGORY_OR_X_AXIS = 0;
@ -100,7 +100,8 @@ public final class AxisRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public AxisRecord clone() {
AxisRecord rec = new AxisRecord();
rec.field_1_axisType = field_1_axisType;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class AxisUsedRecord extends StandardRecord {
public final class AxisUsedRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1046;
private short field_1_numAxis;
@ -69,7 +69,8 @@ public final class AxisUsedRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public AxisUsedRecord clone() {
AxisUsedRecord rec = new AxisUsedRecord();
rec.field_1_numAxis = field_1_numAxis;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class BarRecord extends StandardRecord {
public final class BarRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1017;
private static final BitField horizontal = BitFieldFactory.getInstance(0x1);
@ -95,7 +95,8 @@ public final class BarRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public BarRecord clone() {
BarRecord rec = new BarRecord();
rec.field_1_barSpace = field_1_barSpace;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class BeginRecord extends StandardRecord {
public final class BeginRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x1033;
public BeginRecord()
@ -64,7 +64,8 @@ public final class BeginRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public BeginRecord clone() {
BeginRecord br = new BeginRecord();
// No data so nothing to copy
return br;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class CategorySeriesAxisRecord extends StandardRecord {
public final class CategorySeriesAxisRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1020;
private static final BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1);
@ -100,7 +100,8 @@ public final class CategorySeriesAxisRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public CategorySeriesAxisRecord clone() {
CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord();
rec.field_1_crossingPoint = field_1_crossingPoint;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Patrick Cheng
*/
public final class ChartEndBlockRecord extends StandardRecord {
public final class ChartEndBlockRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x0853;
private short rt;

View File

@ -40,7 +40,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class ChartRecord extends StandardRecord {
public final class ChartRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1002;
private int field_1_x;
private int field_2_y;
@ -87,7 +87,8 @@ public final class ChartRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public ChartRecord clone() {
ChartRecord rec = new ChartRecord();
rec.field_1_x = field_1_x;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Patrick Cheng
*/
public final class ChartStartBlockRecord extends StandardRecord {
public final class ChartStartBlockRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x0852;
private short rt;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class DatRecord extends StandardRecord {
public final class DatRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1063;
private static final BitField horizontalBorder = BitFieldFactory.getInstance(0x1);
@ -81,9 +81,9 @@ public final class DatRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public DatRecord clone() {
DatRecord rec = new DatRecord();
rec.field_1_options = field_1_options;
return rec;
}

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class DataFormatRecord extends StandardRecord {
public final class DataFormatRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1006;
private static final BitField useExcel4Colors = BitFieldFactory.getInstance(0x1);
@ -96,7 +96,8 @@ public final class DataFormatRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public DataFormatRecord clone() {
DataFormatRecord rec = new DataFormatRecord();
rec.field_1_pointNumber = field_1_pointNumber;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord {
public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1024;
private short field_1_categoryDataType;
public final static short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0;
@ -72,7 +72,8 @@ public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public DefaultDataLabelTextPropertiesRecord clone() {
DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord();
rec.field_1_categoryDataType = field_1_categoryDataType;

View File

@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class EndRecord extends StandardRecord {
public final class EndRecord extends StandardRecord implements Cloneable {
public static final short sid = 0x1034;
public EndRecord()
@ -65,7 +65,8 @@ public final class EndRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public EndRecord clone() {
EndRecord er = new EndRecord();
// No data so nothing to copy
return er;

View File

@ -27,8 +27,8 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class FontBasisRecord extends StandardRecord {
public final static short sid = 0x1060;
public final class FontBasisRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1060;
private short field_1_xBasis;
private short field_2_yBasis;
private short field_3_heightBasis;
@ -97,7 +97,8 @@ public final class FontBasisRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public FontBasisRecord clone() {
FontBasisRecord rec = new FontBasisRecord();
rec.field_1_xBasis = field_1_xBasis;

View File

@ -27,8 +27,8 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class FontIndexRecord extends StandardRecord {
public final static short sid = 0x1026;
public final class FontIndexRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1026;
private short field_1_fontIndex;
@ -69,7 +69,8 @@ public final class FontIndexRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public FontIndexRecord clone() {
FontIndexRecord rec = new FontIndexRecord();
rec.field_1_fontIndex = field_1_fontIndex;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class FrameRecord extends StandardRecord {
public final class FrameRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1032;
private static final BitField autoSize = BitFieldFactory.getInstance(0x1);
@ -86,7 +86,8 @@ public final class FrameRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public FrameRecord clone() {
FrameRecord rec = new FrameRecord();
rec.field_1_borderType = field_1_borderType;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class LegendRecord extends StandardRecord {
public final class LegendRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1015;
private static final BitField autoPosition = BitFieldFactory.getInstance(0x01);
@ -136,7 +136,8 @@ public final class LegendRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public LegendRecord clone() {
LegendRecord rec = new LegendRecord();
rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class LineFormatRecord extends StandardRecord {
public final class LineFormatRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1007;
private static final BitField auto = BitFieldFactory.getInstance(0x1);
@ -121,7 +121,8 @@ public final class LineFormatRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public LineFormatRecord clone() {
LineFormatRecord rec = new LineFormatRecord();
rec.field_1_lineColor = field_1_lineColor;

View File

@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class LinkedDataRecord extends StandardRecord {
public final class LinkedDataRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1051;
private static final BitField customNumberFormat= BitFieldFactory.getInstance(0x1);
@ -102,7 +102,8 @@ public final class LinkedDataRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public LinkedDataRecord clone() {
LinkedDataRecord rec = new LinkedDataRecord();
rec.field_1_linkType = field_1_linkType;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class NumberFormatIndexRecord extends StandardRecord {
public final class NumberFormatIndexRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x104E;
private short field_1_formatIndex;
@ -69,7 +69,8 @@ public final class NumberFormatIndexRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public NumberFormatIndexRecord clone() {
NumberFormatIndexRecord rec = new NumberFormatIndexRecord();
rec.field_1_formatIndex = field_1_formatIndex;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class ObjectLinkRecord extends StandardRecord {
public final class ObjectLinkRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x1027;
private short field_1_anchorId;
public final static short ANCHOR_ID_CHART_TITLE = 1;
@ -89,7 +89,8 @@ public final class ObjectLinkRecord extends StandardRecord {
return sid;
}
public Object clone() {
@Override
public ObjectLinkRecord clone() {
ObjectLinkRecord rec = new ObjectLinkRecord();
rec.field_1_anchorId = field_1_anchorId;

View File

@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianOutput;
* Formatting, Sheet Extensions), this XSSF-style color record
* can be used.
*/
public final class ExtendedColor {
public final class ExtendedColor implements Cloneable {
public static final int TYPE_AUTO = 0;
public static final int TYPE_INDEXED = 1;
public static final int TYPE_RGB = 2;
@ -147,7 +147,8 @@ public final class ExtendedColor {
return buffer.toString();
}
public Object clone() {
@Override
public ExtendedColor clone() {
ExtendedColor exc = new ExtendedColor();
exc.type = type;
exc.tint = tint;

Some files were not shown because too many files have changed in this diff Show More