Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java Sun Dec 22 21:44:45 2019 @@ -23,28 +23,28 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The area record is used to define a area chart.<p> - * - * @author Glen Stampoultzis (glens at apache.org) + * The area record is used to define a area chart. */ -public final class AreaRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x101A; - private short field_1_formatFlags; +public final class AreaRecord extends StandardRecord { + public static final short sid = 0x101A; private static final BitField stacked = BitFieldFactory.getInstance(0x1); private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x2); private static final BitField shadow = BitFieldFactory.getInstance(0x4); + private short field_1_formatFlags; - public AreaRecord() - { - } + public AreaRecord() {} - public AreaRecord(RecordInputStream in) - { + public AreaRecord(AreaRecord other) { + super(other); + field_1_formatFlags = other.field_1_formatFlags; + } + public AreaRecord(RecordInputStream in) { field_1_formatFlags = in.readShort(); } @@ -56,10 +56,10 @@ public final class AreaRecord extends St buffer.append(" .formatFlags = ") .append("0x").append(HexDump.toHex( getFormatFlags ())) .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .stacked = ").append(isStacked()).append('\n'); - buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); - buffer.append(" .shadow = ").append(isShadow()).append('\n'); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .stacked = ").append(isStacked()).append('\n'); + buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); + buffer.append(" .shadow = ").append(isShadow()).append('\n'); buffer.append("[/AREA]\n"); return buffer.toString(); @@ -79,16 +79,13 @@ public final class AreaRecord extends St } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public AreaRecord clone() { - AreaRecord rec = new AreaRecord(); - - rec.field_1_formatFlags = field_1_formatFlags; - return rec; + return copy(); } - - - /** * Get the format flags field for the Area record. */ @@ -158,4 +155,9 @@ public final class AreaRecord extends St { return shadow.isSet(field_1_formatFlags); } + + @Override + public AreaRecord copy() { + return new AreaRecord(this); + } }
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java Sun Dec 22 21:44:45 2019 @@ -21,29 +21,29 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The axis line format record defines the axis type details.<p> - * - * @author Glen Stampoultzis (glens at apache.org) + * The axis line format record defines the axis type details. */ -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; - public final static short AXIS_TYPE_MAJOR_GRID_LINE = 1; - public final static short AXIS_TYPE_MINOR_GRID_LINE = 2; - public final static short AXIS_TYPE_WALLS_OR_FLOOR = 3; +public final class AxisLineFormatRecord extends StandardRecord { + public static final short sid = 0x1021; + public static final short AXIS_TYPE_AXIS_LINE = 0; + public static final short AXIS_TYPE_MAJOR_GRID_LINE = 1; + public static final short AXIS_TYPE_MINOR_GRID_LINE = 2; + public static final short AXIS_TYPE_WALLS_OR_FLOOR = 3; + private short field_1_axisType; - public AxisLineFormatRecord() - { + public AxisLineFormatRecord() {} + public AxisLineFormatRecord(AxisLineFormatRecord other) { + super(other); + field_1_axisType = other.field_1_axisType; } - public AxisLineFormatRecord(RecordInputStream in) - { - field_1_axisType = in.readShort(); + public AxisLineFormatRecord(RecordInputStream in) { + field_1_axisType = in.readShort(); } public String toString() @@ -54,7 +54,7 @@ public final class AxisLineFormatRecord buffer.append(" .axisType = ") .append("0x").append(HexDump.toHex( getAxisType ())) .append(" (").append( getAxisType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append("[/AXISLINEFORMAT]\n"); return buffer.toString(); @@ -74,20 +74,17 @@ public final class AxisLineFormatRecord } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public AxisLineFormatRecord clone() { - AxisLineFormatRecord rec = new AxisLineFormatRecord(); - - rec.field_1_axisType = field_1_axisType; - return rec; + return copy(); } - - - /** * Get the axis type field for the AxisLineFormat record. * - * @return One of + * @return One of * AXIS_TYPE_AXIS_LINE * AXIS_TYPE_MAJOR_GRID_LINE * AXIS_TYPE_MINOR_GRID_LINE @@ -102,7 +99,7 @@ public final class AxisLineFormatRecord * Set the axis type field for the AxisLineFormat record. * * @param field_1_axisType - * One of + * One of * AXIS_TYPE_AXIS_LINE * AXIS_TYPE_MAJOR_GRID_LINE * AXIS_TYPE_MINOR_GRID_LINE @@ -112,4 +109,9 @@ public final class AxisLineFormatRecord { this.field_1_axisType = field_1_axisType; } + + @Override + public AxisLineFormatRecord copy() { + return new AxisLineFormatRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java Sun Dec 22 21:44:45 2019 @@ -23,14 +23,13 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The axis options record provides unit information and other various tidbits about the axis.<p> - * - * @author Andrew C. Oliver(acoliver at apache.org) + * The axis options record provides unit information and other various tidbits about the axis. */ -public final class AxisOptionsRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1062; +public final class AxisOptionsRecord extends StandardRecord { + public static final short sid = 0x1062; private static final BitField defaultMinimum = BitFieldFactory.getInstance(0x01); private static final BitField defaultMaximum = BitFieldFactory.getInstance(0x02); @@ -52,22 +51,32 @@ public final class AxisOptionsRecord ext private short field_9_options; - public AxisOptionsRecord() - { + public AxisOptionsRecord() {} + public AxisOptionsRecord(AxisOptionsRecord other) { + super(other); + field_1_minimumCategory = other.field_1_minimumCategory; + field_2_maximumCategory = other.field_2_maximumCategory; + field_3_majorUnitValue = other.field_3_majorUnitValue; + field_4_majorUnit = other.field_4_majorUnit; + field_5_minorUnitValue = other.field_5_minorUnitValue; + field_6_minorUnit = other.field_6_minorUnit; + field_7_baseUnit = other.field_7_baseUnit; + field_8_crossingPoint = other.field_8_crossingPoint; + field_9_options = other.field_9_options; } - public AxisOptionsRecord(RecordInputStream in) - { - field_1_minimumCategory = in.readShort(); - field_2_maximumCategory = in.readShort(); - field_3_majorUnitValue = in.readShort(); - field_4_majorUnit = in.readShort(); - field_5_minorUnitValue = in.readShort(); - field_6_minorUnit = in.readShort(); - field_7_baseUnit = in.readShort(); - field_8_crossingPoint = in.readShort(); - field_9_options = in.readShort(); + + public AxisOptionsRecord(RecordInputStream in) { + field_1_minimumCategory = in.readShort(); + field_2_maximumCategory = in.readShort(); + field_3_majorUnitValue = in.readShort(); + field_4_majorUnit = in.readShort(); + field_5_minorUnitValue = in.readShort(); + field_6_minorUnit = in.readShort(); + field_7_baseUnit = in.readShort(); + field_8_crossingPoint = in.readShort(); + field_9_options = in.readShort(); } public String toString() @@ -78,47 +87,47 @@ public final class AxisOptionsRecord ext buffer.append(" .minimumCategory = ") .append("0x").append(HexDump.toHex( getMinimumCategory ())) .append(" (").append( getMinimumCategory() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .maximumCategory = ") .append("0x").append(HexDump.toHex( getMaximumCategory ())) .append(" (").append( getMaximumCategory() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .majorUnitValue = ") .append("0x").append(HexDump.toHex( getMajorUnitValue ())) .append(" (").append( getMajorUnitValue() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .majorUnit = ") .append("0x").append(HexDump.toHex( getMajorUnit ())) .append(" (").append( getMajorUnit() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .minorUnitValue = ") .append("0x").append(HexDump.toHex( getMinorUnitValue ())) .append(" (").append( getMinorUnitValue() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .minorUnit = ") .append("0x").append(HexDump.toHex( getMinorUnit ())) .append(" (").append( getMinorUnit() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .baseUnit = ") .append("0x").append(HexDump.toHex( getBaseUnit ())) .append(" (").append( getBaseUnit() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .crossingPoint = ") .append("0x").append(HexDump.toHex( getCrossingPoint ())) .append(" (").append( getCrossingPoint() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .options = ") .append("0x").append(HexDump.toHex( getOptions ())) .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .defaultMinimum = ").append(isDefaultMinimum()).append('\n'); - buffer.append(" .defaultMaximum = ").append(isDefaultMaximum()).append('\n'); - buffer.append(" .defaultMajor = ").append(isDefaultMajor()).append('\n'); - buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit()).append('\n'); - buffer.append(" .isDate = ").append(isIsDate()).append('\n'); - buffer.append(" .defaultBase = ").append(isDefaultBase()).append('\n'); - buffer.append(" .defaultCross = ").append(isDefaultCross()).append('\n'); - buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings()).append('\n'); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .defaultMinimum = ").append(isDefaultMinimum()).append('\n'); + buffer.append(" .defaultMaximum = ").append(isDefaultMaximum()).append('\n'); + buffer.append(" .defaultMajor = ").append(isDefaultMajor()).append('\n'); + buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit()).append('\n'); + buffer.append(" .isDate = ").append(isIsDate()).append('\n'); + buffer.append(" .defaultBase = ").append(isDefaultBase()).append('\n'); + buffer.append(" .defaultCross = ").append(isDefaultCross()).append('\n'); + buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings()).append('\n'); buffer.append("[/AXCEXT]\n"); return buffer.toString(); @@ -146,24 +155,13 @@ public final class AxisOptionsRecord ext } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public AxisOptionsRecord clone() { - AxisOptionsRecord rec = new AxisOptionsRecord(); - - rec.field_1_minimumCategory = field_1_minimumCategory; - rec.field_2_maximumCategory = field_2_maximumCategory; - rec.field_3_majorUnitValue = field_3_majorUnitValue; - rec.field_4_majorUnit = field_4_majorUnit; - rec.field_5_minorUnitValue = field_5_minorUnitValue; - rec.field_6_minorUnit = field_6_minorUnit; - rec.field_7_baseUnit = field_7_baseUnit; - rec.field_8_crossingPoint = field_8_crossingPoint; - rec.field_9_options = field_9_options; - return rec; + return copy(); } - - - /** * Get the minimum category field for the AxisOptions record. */ @@ -451,4 +449,9 @@ public final class AxisOptionsRecord ext { return defaultDateSettings.isSet(field_9_options); } + + @Override + public AxisOptionsRecord copy() { + return new AxisOptionsRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java Sun Dec 22 21:44:45 2019 @@ -21,35 +21,41 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The axis size and location<p> - * - * @author Glen Stampoultzis (glens at apache.org) + * The axis size and location */ -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; - public final static short AXIS_TYPE_SECONDARY = 1; - private int field_2_x; - private int field_3_y; - private int field_4_width; - private int field_5_height; - - - public AxisParentRecord() - { - +public final class AxisParentRecord extends StandardRecord { + public static final short sid = 0x1041; + public static final short AXIS_TYPE_MAIN = 0; + public static final short AXIS_TYPE_SECONDARY = 1; + + private short field_1_axisType; + private int field_2_x; + private int field_3_y; + private int field_4_width; + private int field_5_height; + + + public AxisParentRecord() {} + + public AxisParentRecord(AxisParentRecord other) { + super(other); + field_1_axisType = other.field_1_axisType; + field_2_x = other.field_2_x; + field_3_y = other.field_3_y; + field_4_width = other.field_4_width; + field_5_height = other.field_5_height; } - public AxisParentRecord(RecordInputStream in) - { - field_1_axisType = in.readShort(); - field_2_x = in.readInt(); - field_3_y = in.readInt(); - field_4_width = in.readInt(); - field_5_height = in.readInt(); + + public AxisParentRecord(RecordInputStream in) { + field_1_axisType = in.readShort(); + field_2_x = in.readInt(); + field_3_y = in.readInt(); + field_4_width = in.readInt(); + field_5_height = in.readInt(); } public String toString() @@ -60,23 +66,23 @@ public final class AxisParentRecord exte buffer.append(" .axisType = ") .append("0x").append(HexDump.toHex( getAxisType ())) .append(" (").append( getAxisType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .x = ") .append("0x").append(HexDump.toHex( getX ())) .append(" (").append( getX() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .y = ") .append("0x").append(HexDump.toHex( getY ())) .append(" (").append( getY() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .width = ") .append("0x").append(HexDump.toHex( getWidth ())) .append(" (").append( getWidth() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .height = ") .append("0x").append(HexDump.toHex( getHeight ())) .append(" (").append( getHeight() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append("[/AXISPARENT]\n"); return buffer.toString(); @@ -100,24 +106,17 @@ public final class AxisParentRecord exte } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public AxisParentRecord clone() { - AxisParentRecord rec = new AxisParentRecord(); - - rec.field_1_axisType = field_1_axisType; - rec.field_2_x = field_2_x; - rec.field_3_y = field_3_y; - rec.field_4_width = field_4_width; - rec.field_5_height = field_5_height; - return rec; + return copy(); } - - - /** * Get the axis type field for the AxisParent record. * - * @return One of + * @return One of * AXIS_TYPE_MAIN * AXIS_TYPE_SECONDARY */ @@ -130,7 +129,7 @@ public final class AxisParentRecord exte * Set the axis type field for the AxisParent record. * * @param field_1_axisType - * One of + * One of * AXIS_TYPE_MAIN * AXIS_TYPE_SECONDARY */ @@ -202,4 +201,9 @@ public final class AxisParentRecord exte { this.field_5_height = field_5_height; } + + @Override + public AxisParentRecord copy() { + return new AxisParentRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java Sun Dec 22 21:44:45 2019 @@ -21,36 +21,40 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The axis record defines the type of an axis.<p> - * - * @author Glen Stampoultzis (glens at apache.org) + * The axis record defines the type of an axis. */ -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; - public final static short AXIS_TYPE_VALUE_AXIS = 1; - public final static short AXIS_TYPE_SERIES_AXIS = 2; - private int field_2_reserved1; - private int field_3_reserved2; - private int field_4_reserved3; - private int field_5_reserved4; - - - public AxisRecord() - { - - } - - public AxisRecord(RecordInputStream in) - { - field_1_axisType = in.readShort(); - field_2_reserved1 = in.readInt(); - field_3_reserved2 = in.readInt(); - field_4_reserved3 = in.readInt(); - field_5_reserved4 = in.readInt(); +public final class AxisRecord extends StandardRecord { + public static final short sid = 0x101d; + public static final short AXIS_TYPE_CATEGORY_OR_X_AXIS = 0; + public static final short AXIS_TYPE_VALUE_AXIS = 1; + public static final short AXIS_TYPE_SERIES_AXIS = 2; + + private short field_1_axisType; + private int field_2_reserved1; + private int field_3_reserved2; + private int field_4_reserved3; + private int field_5_reserved4; + + public AxisRecord() {} + + public AxisRecord(AxisRecord other) { + super(other); + field_1_axisType = other.field_1_axisType; + field_2_reserved1 = other.field_2_reserved1; + field_3_reserved2 = other.field_3_reserved2; + field_4_reserved3 = other.field_4_reserved3; + field_5_reserved4 = other.field_5_reserved4; + } + + public AxisRecord(RecordInputStream in) { + field_1_axisType = in.readShort(); + field_2_reserved1 = in.readInt(); + field_3_reserved2 = in.readInt(); + field_4_reserved3 = in.readInt(); + field_5_reserved4 = in.readInt(); } public String toString() @@ -61,23 +65,23 @@ public final class AxisRecord extends St buffer.append(" .axisType = ") .append("0x").append(HexDump.toHex( getAxisType ())) .append(" (").append( getAxisType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .reserved1 = ") .append("0x").append(HexDump.toHex( getReserved1 ())) .append(" (").append( getReserved1() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .reserved2 = ") .append("0x").append(HexDump.toHex( getReserved2 ())) .append(" (").append( getReserved2() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .reserved3 = ") .append("0x").append(HexDump.toHex( getReserved3 ())) .append(" (").append( getReserved3() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .reserved4 = ") .append("0x").append(HexDump.toHex( getReserved4 ())) .append(" (").append( getReserved4() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append("[/AXIS]\n"); return buffer.toString(); @@ -101,24 +105,17 @@ public final class AxisRecord extends St } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public AxisRecord clone() { - AxisRecord rec = new AxisRecord(); - - rec.field_1_axisType = field_1_axisType; - rec.field_2_reserved1 = field_2_reserved1; - rec.field_3_reserved2 = field_3_reserved2; - rec.field_4_reserved3 = field_4_reserved3; - rec.field_5_reserved4 = field_5_reserved4; - return rec; + return copy(); } - - - /** * Get the axis type field for the Axis record. * - * @return One of + * @return One of * AXIS_TYPE_CATEGORY_OR_X_AXIS * AXIS_TYPE_VALUE_AXIS * AXIS_TYPE_SERIES_AXIS @@ -132,7 +129,7 @@ public final class AxisRecord extends St * Set the axis type field for the Axis record. * * @param field_1_axisType - * One of + * One of * AXIS_TYPE_CATEGORY_OR_X_AXIS * AXIS_TYPE_VALUE_AXIS * AXIS_TYPE_SERIES_AXIS @@ -205,4 +202,9 @@ public final class AxisRecord extends St { this.field_5_reserved4 = field_5_reserved4; } + + @Override + public AxisRecord copy() { + return new AxisRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java Sun Dec 22 21:44:45 2019 @@ -21,25 +21,25 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The number of axes used on a chart.<p> - * - * @author Glen Stampoultzis (glens at apache.org) + * The number of axes used on a chart. */ -public final class AxisUsedRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1046; - private short field_1_numAxis; +public final class AxisUsedRecord extends StandardRecord { + public static final short sid = 0x1046; + private short field_1_numAxis; - public AxisUsedRecord() - { + public AxisUsedRecord() {} + public AxisUsedRecord(AxisUsedRecord other) { + super(other); + field_1_numAxis = other.field_1_numAxis; } - public AxisUsedRecord(RecordInputStream in) - { - field_1_numAxis = in.readShort(); + public AxisUsedRecord(RecordInputStream in) { + field_1_numAxis = in.readShort(); } public String toString() @@ -50,7 +50,7 @@ public final class AxisUsedRecord extend buffer.append(" .numAxis = ") .append("0x").append(HexDump.toHex( getNumAxis ())) .append(" (").append( getNumAxis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append("[/AXISUSED]\n"); return buffer.toString(); @@ -70,16 +70,13 @@ public final class AxisUsedRecord extend } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public AxisUsedRecord clone() { - AxisUsedRecord rec = new AxisUsedRecord(); - - rec.field_1_numAxis = field_1_numAxis; - return rec; + return copy(); } - - - /** * Get the num axis field for the AxisUsed record. */ @@ -95,4 +92,9 @@ public final class AxisUsedRecord extend { this.field_1_numAxis = field_1_numAxis; } + + @Override + public AxisUsedRecord copy() { + return new AxisUsedRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/BarRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/BarRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/BarRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/BarRecord.java Sun Dec 22 21:44:45 2019 @@ -23,35 +23,37 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The bar record is used to define a bar chart.<p> - * - * @author Glen Stampoultzis (glens at apache.org) + * The bar record is used to define a bar chart. */ -public final class BarRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1017; +public final class BarRecord extends StandardRecord { + public static final short sid = 0x1017; - private static final BitField horizontal = BitFieldFactory.getInstance(0x1); - private static final BitField stacked = BitFieldFactory.getInstance(0x2); - private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x4); - private static final BitField shadow = BitFieldFactory.getInstance(0x8); + private static final BitField horizontal = BitFieldFactory.getInstance(0x1); + private static final BitField stacked = BitFieldFactory.getInstance(0x2); + private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x4); + private static final BitField shadow = BitFieldFactory.getInstance(0x8); - private short field_1_barSpace; - private short field_2_categorySpace; - private short field_3_formatFlags; + private short field_1_barSpace; + private short field_2_categorySpace; + private short field_3_formatFlags; - public BarRecord() - { + public BarRecord() {} + public BarRecord(BarRecord other) { + super(other); + field_1_barSpace = other.field_1_barSpace; + field_2_categorySpace = other.field_2_categorySpace; + field_3_formatFlags = other.field_3_formatFlags; } - public BarRecord(RecordInputStream in) - { - field_1_barSpace = in.readShort(); - field_2_categorySpace = in.readShort(); - field_3_formatFlags = in.readShort(); + public BarRecord(RecordInputStream in) { + field_1_barSpace = in.readShort(); + field_2_categorySpace = in.readShort(); + field_3_formatFlags = in.readShort(); } public String toString() @@ -62,19 +64,19 @@ public final class BarRecord extends Sta buffer.append(" .barSpace = ") .append("0x").append(HexDump.toHex( getBarSpace ())) .append(" (").append( getBarSpace() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .categorySpace = ") .append("0x").append(HexDump.toHex( getCategorySpace ())) .append(" (").append( getCategorySpace() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .formatFlags = ") .append("0x").append(HexDump.toHex( getFormatFlags ())) .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .horizontal = ").append(isHorizontal()).append('\n'); - buffer.append(" .stacked = ").append(isStacked()).append('\n'); - buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); - buffer.append(" .shadow = ").append(isShadow()).append('\n'); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .horizontal = ").append(isHorizontal()).append('\n'); + buffer.append(" .stacked = ").append(isStacked()).append('\n'); + buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); + buffer.append(" .shadow = ").append(isShadow()).append('\n'); buffer.append("[/BAR]\n"); return buffer.toString(); @@ -96,18 +98,13 @@ public final class BarRecord extends Sta } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public BarRecord clone() { - BarRecord rec = new BarRecord(); - - rec.field_1_barSpace = field_1_barSpace; - rec.field_2_categorySpace = field_2_categorySpace; - rec.field_3_formatFlags = field_3_formatFlags; - return rec; + return copy(); } - - - /** * Get the bar space field for the Bar record. */ @@ -227,4 +224,9 @@ public final class BarRecord extends Sta { return shadow.isSet(field_3_formatFlags); } + + @Override + public BarRecord copy() { + return new BarRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java Sun Dec 22 21:44:45 2019 @@ -20,28 +20,27 @@ package org.apache.poi.hssf.record.chart import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * The begin record defines the start of a block of records for a (grpahing + * The begin record defines the start of a block of records for a (graphing * data object. This record is matched with a corresponding EndRecord. * * @see EndRecord - * - * @author Glen Stampoultzis (glens at apache.org) */ -public final class BeginRecord extends StandardRecord implements Cloneable { +public final class BeginRecord extends StandardRecord { public static final short sid = 0x1033; - public BeginRecord() - { + public BeginRecord() {} + + public BeginRecord(BeginRecord other) { + super(other); } /** * @param in unused (since this record has no data) */ - public BeginRecord(RecordInputStream in) - { - } + public BeginRecord(RecordInputStream in) {} public String toString() { @@ -63,10 +62,17 @@ public final class BeginRecord extends S { return sid; } - + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public BeginRecord clone() { - // No data so nothing to copy - return new BeginRecord(); + return copy(); + } + + @Override + public BeginRecord copy() { + return new BeginRecord(this); } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/CatLabRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/CatLabRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/CatLabRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/CatLabRecord.java Sun Dec 22 21:44:45 2019 @@ -23,27 +23,35 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; /** - * CATLAB - Category Labels (0x0856)<br> - * - * @author Patrick Cheng + * CATLAB - Category Labels (0x0856) */ public final class CatLabRecord extends StandardRecord { public static final short sid = 0x0856; - + private short rt; private short grbitFrt; private short wOffset; private short at; private short grbit; private Short unused; - + + public CatLabRecord(CatLabRecord other) { + super(other); + rt = other.rt; + grbitFrt = other.grbitFrt; + wOffset = other.wOffset; + at = other.at; + grbit = other.grbit; + unused = other.unused; + } + public CatLabRecord(RecordInputStream in) { rt = in.readShort(); grbitFrt = in.readShort(); wOffset = in.readShort(); at = in.readShort(); grbit = in.readShort(); - + // Often, but not always has an unused short at the end if(in.available() == 0) { unused = null; @@ -51,7 +59,7 @@ public final class CatLabRecord extends unused = in.readShort(); } } - + @Override protected int getDataSize() { return 2 + 2 + 2 + 2 + 2 + (unused==null? 0:2); @@ -89,4 +97,9 @@ public final class CatLabRecord extends buffer.append("[/CATLAB]\n"); return buffer.toString(); } + + @Override + public CatLabRecord copy() { + return new CatLabRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java Sun Dec 22 21:44:45 2019 @@ -23,36 +23,39 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * This record refers to a category or series axis and is used to specify label/tickmark frequency.<p> - * - * @author Glen Stampoultzis (glens at apache.org) + * This record refers to a category or series axis and is used to specify label/tickmark frequency. */ -public final class CategorySeriesAxisRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1020; +public final class CategorySeriesAxisRecord extends StandardRecord { + public static final short sid = 0x1020; private static final BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1); private static final BitField crossesFarRight = BitFieldFactory.getInstance(0x2); private static final BitField reversed = BitFieldFactory.getInstance(0x4); - - private short field_1_crossingPoint; - private short field_2_labelFrequency; - private short field_3_tickMarkFrequency; - private short field_4_options; - - public CategorySeriesAxisRecord() - { - - } - - public CategorySeriesAxisRecord(RecordInputStream in) - { - field_1_crossingPoint = in.readShort(); - field_2_labelFrequency = in.readShort(); - field_3_tickMarkFrequency = in.readShort(); - field_4_options = in.readShort(); + private short field_1_crossingPoint; + private short field_2_labelFrequency; + private short field_3_tickMarkFrequency; + private short field_4_options; + + + public CategorySeriesAxisRecord() {} + + public CategorySeriesAxisRecord(CategorySeriesAxisRecord other) { + super(other); + field_1_crossingPoint = other.field_1_crossingPoint; + field_2_labelFrequency = other.field_2_labelFrequency; + field_3_tickMarkFrequency = other.field_3_tickMarkFrequency; + field_4_options = other.field_4_options; + } + + public CategorySeriesAxisRecord(RecordInputStream in) { + field_1_crossingPoint = in.readShort(); + field_2_labelFrequency = in.readShort(); + field_3_tickMarkFrequency = in.readShort(); + field_4_options = in.readShort(); } public String toString() @@ -63,22 +66,22 @@ public final class CategorySeriesAxisRec buffer.append(" .crossingPoint = ") .append("0x").append(HexDump.toHex( getCrossingPoint ())) .append(" (").append( getCrossingPoint() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .labelFrequency = ") .append("0x").append(HexDump.toHex( getLabelFrequency ())) .append(" (").append( getLabelFrequency() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .tickMarkFrequency = ") .append("0x").append(HexDump.toHex( getTickMarkFrequency ())) .append(" (").append( getTickMarkFrequency() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .options = ") .append("0x").append(HexDump.toHex( getOptions ())) .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing()).append('\n'); - buffer.append(" .crossesFarRight = ").append(isCrossesFarRight()).append('\n'); - buffer.append(" .reversed = ").append(isReversed()).append('\n'); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing()).append('\n'); + buffer.append(" .crossesFarRight = ").append(isCrossesFarRight()).append('\n'); + buffer.append(" .reversed = ").append(isReversed()).append('\n'); buffer.append("[/CATSERRANGE]\n"); return buffer.toString(); @@ -101,19 +104,13 @@ public final class CategorySeriesAxisRec } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public CategorySeriesAxisRecord clone() { - CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord(); - - rec.field_1_crossingPoint = field_1_crossingPoint; - rec.field_2_labelFrequency = field_2_labelFrequency; - rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency; - rec.field_4_options = field_4_options; - return rec; + return copy(); } - - - /** * Get the crossing point field for the CategorySeriesAxis record. */ @@ -231,4 +228,9 @@ public final class CategorySeriesAxisRec { return reversed.isSet(field_4_options); } + + @Override + public CategorySeriesAxisRecord copy() { + return new CategorySeriesAxisRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java Sun Dec 22 21:44:45 2019 @@ -21,13 +21,12 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** - * ENDBLOCK - Chart Future Record Type End Block (0x0853)<br> - * - * @author Patrick Cheng + * ENDBLOCK - Chart Future Record Type End Block (0x0853) */ -public final class ChartEndBlockRecord extends StandardRecord implements Cloneable { +public final class ChartEndBlockRecord extends StandardRecord { public static final short sid = 0x0853; private short rt; @@ -35,9 +34,16 @@ public final class ChartEndBlockRecord e private short iObjectKind; private byte[] unused; - public ChartEndBlockRecord() { + public ChartEndBlockRecord() {} + + public ChartEndBlockRecord(ChartEndBlockRecord other) { + super(other); + rt = other.rt; + grbitFrt = other.grbitFrt; + iObjectKind = other.iObjectKind; + unused = (other.unused == null) ? null : other.unused.clone(); } - + public ChartEndBlockRecord(RecordInputStream in) { rt = in.readShort(); grbitFrt = in.readShort(); @@ -83,16 +89,17 @@ public final class ChartEndBlockRecord e buffer.append("[/ENDBLOCK]\n"); return buffer.toString(); } - + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public ChartEndBlockRecord clone() { - ChartEndBlockRecord record = new ChartEndBlockRecord(); - - record.rt = rt ; - record.grbitFrt = grbitFrt ; - record.iObjectKind = iObjectKind ; - record.unused = unused.clone() ; - - return record; + return copy(); + } + + @Override + public ChartEndBlockRecord copy() { + return new ChartEndBlockRecord(this); } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndObjectRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndObjectRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndObjectRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartEndObjectRecord.java Sun Dec 22 21:44:45 2019 @@ -33,6 +33,14 @@ public final class ChartEndObjectRecord private short iObjectKind; private byte[] reserved; + public ChartEndObjectRecord(ChartEndObjectRecord other) { + super(other); + rt = other.rt; + grbitFrt = other.grbitFrt; + iObjectKind = other.iObjectKind; + reserved = (other.reserved == null) ? null : other.reserved.clone(); + } + public ChartEndObjectRecord(RecordInputStream in) { rt = in.readShort(); grbitFrt = in.readShort(); @@ -45,7 +53,7 @@ public final class ChartEndObjectRecord if(in.available() == 0) { // They've gone missing... } else { - // Read the reserved bytes + // Read the reserved bytes in.readFully(reserved); } } @@ -81,4 +89,9 @@ public final class ChartEndObjectRecord buffer.append("[/ENDOBJECT]\n"); return buffer.toString(); } + + @Override + public ChartEndObjectRecord copy() { + return new ChartEndObjectRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFRTInfoRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFRTInfoRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFRTInfoRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFRTInfoRecord.java Sun Dec 22 21:44:45 2019 @@ -17,6 +17,8 @@ package org.apache.poi.hssf.record.chart; +import java.util.stream.Stream; + import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; @@ -40,6 +42,11 @@ public final class ChartFRTInfoRecord ex private int rtFirst; private int rtLast; + public CFRTID(CFRTID other) { + rtFirst = other.rtFirst; + rtLast = other.rtLast; + } + public CFRTID(LittleEndianInput in) { rtFirst = in.readShort(); rtLast = in.readShort(); @@ -51,6 +58,17 @@ public final class ChartFRTInfoRecord ex } } + public ChartFRTInfoRecord(ChartFRTInfoRecord other) { + super(other); + rt = other.rt; + grbitFrt = other.grbitFrt; + verOriginator = other.verOriginator; + verWriter = other.verWriter; + if (other.rgCFRTID != null) { + rgCFRTID = Stream.of(other.rgCFRTID).map(CFRTID::new).toArray(CFRTID[]::new); + } + } + public ChartFRTInfoRecord(RecordInputStream in) { rt = in.readShort(); grbitFrt = in.readShort(); @@ -81,11 +99,10 @@ public final class ChartFRTInfoRecord ex out.writeShort(grbitFrt); out.writeByte(verOriginator); out.writeByte(verWriter); - int nCFRTIDs = rgCFRTID.length; - out.writeShort(nCFRTIDs); + out.writeShort(rgCFRTID.length); - for (int i = 0; i < nCFRTIDs; i++) { - rgCFRTID[i].serialize(out); + for (CFRTID cfrtid : rgCFRTID) { + cfrtid.serialize(out); } } @@ -102,4 +119,9 @@ public final class ChartFRTInfoRecord ex buffer.append("[/CHARTFRTINFO]\n"); return buffer.toString(); } + + @Override + public ChartFRTInfoRecord copy() { + return new ChartFRTInfoRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFormatRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFormatRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFormatRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartFormatRecord.java Sun Dec 22 21:44:45 2019 @@ -43,10 +43,19 @@ public final class ChartFormatRecord ext private int field5_grbit; private int field6_unknown; - public ChartFormatRecord() { - // fields uninitialised + public ChartFormatRecord() {} + + public ChartFormatRecord(ChartFormatRecord other) { + super(other); + field1_x_position = other.field1_x_position; + field2_y_position = other.field2_y_position; + field3_width = other.field3_width; + field4_height = other.field4_height; + field5_grbit = other.field5_grbit; + field6_unknown = other.field6_unknown; } + public ChartFormatRecord(RecordInputStream in) { field1_x_position = in.readInt(); field2_y_position = in.readInt(); @@ -125,4 +134,9 @@ public final class ChartFormatRecord ext public void setVaryDisplayPattern(boolean value) { field5_grbit = varyDisplayPattern.setBoolean(field5_grbit, value); } + + @Override + public ChartFormatRecord copy() { + return new ChartFormatRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java Sun Dec 22 21:44:45 2019 @@ -20,34 +20,40 @@ package org.apache.poi.hssf.record.chart import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** * CHART (0x1002)<p> - * + * * The chart record is used to define the location and size of a chart.<p> - * - * Chart related records don't seem to be covered in either the - * <A HREF="http://sc.openoffice.org/excelfileformat.pdf">OOO</A> - * or the - * <A HREF="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Excel97-2007BinaryFileFormat(xls)Specification.pdf">MS</A> - * documentation. - * + * + * Chart related records don't seem to be covered in either the + * <A HREF="http://sc.openoffice.org/excelfileformat.pdf">OOO</A> + * or the + * <A HREF="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Excel97-2007BinaryFileFormat(xls)Specification.pdf">MS</A> + * documentation. + * * The book "Microsoft Excel 97 Developer's Kit" ISBN: (1-57231-498-2) seems to have an entire - * chapter (10) devoted to Chart records. One + * chapter (10) devoted to Chart records. One * <A HREF="http://ooxmlisdefectivebydesign.blogspot.com/2008/03/bad-surprise-in-microsoft-office-binary.html">blog</A> * suggests that some documentation for these records is available in "MSDN Library, Feb 1998", * but no later. */ -public final class ChartRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1002; +public final class ChartRecord extends StandardRecord { + public static final short sid = 0x1002; private int field_1_x; private int field_2_y; private int field_3_width; private int field_4_height; + public ChartRecord() {} - public ChartRecord() { - // fields uninitialised + public ChartRecord(ChartRecord other) { + super(other); + field_1_x = other.field_1_x; + field_2_y = other.field_2_y; + field_3_width = other.field_3_width; + field_4_height = other.field_4_height; } public ChartRecord(RecordInputStream in) { @@ -86,18 +92,17 @@ public final class ChartRecord extends S } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public ChartRecord clone() { - ChartRecord rec = new ChartRecord(); - - rec.field_1_x = field_1_x; - rec.field_2_y = field_2_y; - rec.field_3_width = field_3_width; - rec.field_4_height = field_4_height; - return rec; + return copy(); } - - + @Override + public ChartRecord copy() { + return new ChartRecord(this); + } /** * Get the x field for the Chart record. Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java Sun Dec 22 21:44:45 2019 @@ -21,11 +21,12 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** * STARTBLOCK - Chart Future Record Type Start Block (0x0852) */ -public final class ChartStartBlockRecord extends StandardRecord implements Cloneable { +public final class ChartStartBlockRecord extends StandardRecord { public static final short sid = 0x0852; private short rt; @@ -35,9 +36,18 @@ public final class ChartStartBlockRecord private short iObjectInstance1; private short iObjectInstance2; - public ChartStartBlockRecord() { + public ChartStartBlockRecord() {} + + public ChartStartBlockRecord(ChartStartBlockRecord other) { + super(other); + rt = other.rt; + grbitFrt = other.grbitFrt; + iObjectKind = other.iObjectKind; + iObjectContext = other.iObjectContext; + iObjectInstance1 = other.iObjectInstance1; + iObjectInstance2 = other.iObjectInstance2; } - + public ChartStartBlockRecord(RecordInputStream in) { rt = in.readShort(); grbitFrt = in.readShort(); @@ -81,18 +91,17 @@ public final class ChartStartBlockRecord buffer.append("[/STARTBLOCK]\n"); return buffer.toString(); } - + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public ChartStartBlockRecord clone() { - ChartStartBlockRecord record = new ChartStartBlockRecord(); - - record.rt = rt; - record.grbitFrt = grbitFrt; - record.iObjectKind = iObjectKind; - record.iObjectContext = iObjectContext; - record.iObjectInstance1 = iObjectInstance1; - record.iObjectInstance2 = iObjectInstance2; - - return record; + return copy(); + } + + @Override + public ChartStartBlockRecord copy() { + return new ChartStartBlockRecord(this); } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartObjectRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartObjectRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartObjectRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartStartObjectRecord.java Sun Dec 22 21:44:45 2019 @@ -35,6 +35,16 @@ public final class ChartStartObjectRecor private short iObjectInstance1; private short iObjectInstance2; + public ChartStartObjectRecord(ChartStartObjectRecord other) { + super(other); + rt = other.rt; + grbitFrt = other.grbitFrt; + iObjectKind = other.iObjectKind; + iObjectContext = other.iObjectContext; + iObjectInstance1 = other.iObjectInstance1; + iObjectInstance2 = other.iObjectInstance2; + } + public ChartStartObjectRecord(RecordInputStream in) { rt = in.readShort(); grbitFrt = in.readShort(); @@ -78,4 +88,9 @@ public final class ChartStartObjectRecor buffer.append("[/STARTOBJECT]\n"); return buffer.toString(); } + + @Override + public ChartStartObjectRecord copy() { + return new ChartStartObjectRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartTitleFormatRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartTitleFormatRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartTitleFormatRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/ChartTitleFormatRecord.java Sun Dec 22 21:44:45 2019 @@ -20,6 +20,8 @@ */ package org.apache.poi.hssf.record.chart; +import java.util.stream.Stream; + import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.LittleEndianOutput; @@ -30,14 +32,19 @@ import org.apache.poi.util.LittleEndianO */ public class ChartTitleFormatRecord extends StandardRecord { public static final short sid = 0x1050; - - private CTFormat[] _formats; - + + private final CTFormat[] _formats; + private static final class CTFormat { public static final int ENCODED_SIZE=4; private int _offset; private int _fontIndex; - + + public CTFormat(CTFormat other) { + _offset = other._offset; + _fontIndex = other._fontIndex; + } + public CTFormat(RecordInputStream in) { _offset = in.readShort(); _fontIndex = in.readShort(); @@ -59,6 +66,10 @@ public class ChartTitleFormatRecord exte } } + public ChartTitleFormatRecord(ChartTitleFormatRecord other) { + super(other); + _formats = Stream.of(other._formats).map(CTFormat::new).toArray(CTFormat[]::new); + } public ChartTitleFormatRecord(RecordInputStream in) { int nRecs = in.readUShort(); @@ -79,15 +90,15 @@ public class ChartTitleFormatRecord exte protected int getDataSize() { return 2 + CTFormat.ENCODED_SIZE * _formats.length; } - + public short getSid() { return sid; } - + public int getFormatCount() { return _formats.length; } - + public void modifyFormatRun(short oldPos, short newLen) { int shift = 0; for(int i=0; i < _formats.length; i++) { @@ -97,10 +108,10 @@ public class ChartTitleFormatRecord exte } else if (oldPos == ctf.getOffset() && i < _formats.length - 1){ CTFormat nextCTF = _formats[i + 1]; shift = newLen - (nextCTF.getOffset() - ctf.getOffset()); - } + } } } - + public String toString() { StringBuilder buffer = new StringBuilder(); @@ -115,4 +126,9 @@ public class ChartTitleFormatRecord exte buffer.append("[/CHARTTITLEFORMAT]\n"); return buffer.toString(); } + + @Override + public ChartTitleFormatRecord copy() { + return new ChartTitleFormatRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/DatRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/DatRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/DatRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/DatRecord.java Sun Dec 22 21:44:45 2019 @@ -23,29 +23,30 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** * The dat record is used to store options for the chart. */ -public final class DatRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1063; +public final class DatRecord extends StandardRecord { + public static final short sid = 0x1063; private static final BitField horizontalBorder = BitFieldFactory.getInstance(0x1); private static final BitField verticalBorder = BitFieldFactory.getInstance(0x2); private static final BitField border = BitFieldFactory.getInstance(0x4); private static final BitField showSeriesKey = BitFieldFactory.getInstance(0x8); - private short field_1_options; + private short field_1_options; + public DatRecord() {} - public DatRecord() - { - + public DatRecord(DatRecord other) { + super(other); + field_1_options = other.field_1_options; } - public DatRecord(RecordInputStream in) - { - field_1_options = in.readShort(); + public DatRecord(RecordInputStream in) { + field_1_options = in.readShort(); } public String toString() @@ -56,11 +57,11 @@ public final class DatRecord extends Sta buffer.append(" .options = ") .append("0x").append(HexDump.toHex( getOptions ())) .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .horizontalBorder = ").append(isHorizontalBorder()).append('\n'); - buffer.append(" .verticalBorder = ").append(isVerticalBorder()).append('\n'); - buffer.append(" .border = ").append(isBorder()).append('\n'); - buffer.append(" .showSeriesKey = ").append(isShowSeriesKey()).append('\n'); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .horizontalBorder = ").append(isHorizontalBorder()).append('\n'); + buffer.append(" .verticalBorder = ").append(isVerticalBorder()).append('\n'); + buffer.append(" .border = ").append(isBorder()).append('\n'); + buffer.append(" .showSeriesKey = ").append(isShowSeriesKey()).append('\n'); buffer.append("[/DAT]\n"); return buffer.toString(); @@ -80,14 +81,17 @@ public final class DatRecord extends Sta } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public DatRecord clone() { - DatRecord rec = new DatRecord(); - rec.field_1_options = field_1_options; - return rec; + return copy(); } - - + @Override + public DatRecord copy() { + return new DatRecord(this); + } /** * Get the options field for the Dat record. Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java Sun Dec 22 21:44:45 2019 @@ -23,12 +23,13 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** * The data format record is used to index into a series. */ -public final class DataFormatRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1006; +public final class DataFormatRecord extends StandardRecord { + public static final short sid = 0x1006; private static final BitField useExcel4Colors = BitFieldFactory.getInstance(0x1); @@ -37,18 +38,21 @@ public final class DataFormatRecord exte private short field_3_seriesNumber; private short field_4_formatFlags; + public DataFormatRecord() {} - public DataFormatRecord() - { - + public DataFormatRecord(DataFormatRecord other) { + super(other); + field_1_pointNumber = other.field_1_pointNumber; + field_2_seriesIndex = other.field_2_seriesIndex; + field_3_seriesNumber = other.field_3_seriesNumber; + field_4_formatFlags = other.field_4_formatFlags; } - public DataFormatRecord(RecordInputStream in) - { - field_1_pointNumber = in.readShort(); - field_2_seriesIndex = in.readShort(); - field_3_seriesNumber = in.readShort(); - field_4_formatFlags = in.readShort(); + public DataFormatRecord(RecordInputStream in) { + field_1_pointNumber = in.readShort(); + field_2_seriesIndex = in.readShort(); + field_3_seriesNumber = in.readShort(); + field_4_formatFlags = in.readShort(); } public String toString() @@ -59,20 +63,20 @@ public final class DataFormatRecord exte buffer.append(" .pointNumber = ") .append("0x").append(HexDump.toHex( getPointNumber ())) .append(" (").append( getPointNumber() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .seriesIndex = ") .append("0x").append(HexDump.toHex( getSeriesIndex ())) .append(" (").append( getSeriesIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .seriesNumber = ") .append("0x").append(HexDump.toHex( getSeriesNumber ())) .append(" (").append( getSeriesNumber() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .formatFlags = ") .append("0x").append(HexDump.toHex( getFormatFlags ())) .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .useExcel4Colors = ").append(isUseExcel4Colors()).append('\n'); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .useExcel4Colors = ").append(isUseExcel4Colors()).append('\n'); buffer.append("[/DATAFORMAT]\n"); return buffer.toString(); @@ -95,18 +99,17 @@ public final class DataFormatRecord exte } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public DataFormatRecord clone() { - DataFormatRecord rec = new DataFormatRecord(); - - rec.field_1_pointNumber = field_1_pointNumber; - rec.field_2_seriesIndex = field_2_seriesIndex; - rec.field_3_seriesNumber = field_3_seriesNumber; - rec.field_4_formatFlags = field_4_formatFlags; - return rec; + return copy(); } - - + @Override + public DataFormatRecord copy() { + return new DataFormatRecord(this); + } /** * Get the point number field for the DataFormat record. Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataLabelExtensionRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataLabelExtensionRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataLabelExtensionRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/DataLabelExtensionRecord.java Sun Dec 22 21:44:45 2019 @@ -27,17 +27,24 @@ import org.apache.poi.util.LittleEndianO */ public final class DataLabelExtensionRecord extends StandardRecord { public static final short sid = 0x086A; - + private int rt; private int grbitFrt; - private byte[] unused = new byte[8]; - + private final byte[] unused = new byte[8]; + + public DataLabelExtensionRecord(DataLabelExtensionRecord other) { + super(other); + rt = other.rt; + grbitFrt = other.grbitFrt; + System.arraycopy(other.unused, 0, unused, 0, unused.length); + } + public DataLabelExtensionRecord(RecordInputStream in) { rt = in.readShort(); grbitFrt = in.readShort(); in.readFully(unused); } - + @Override protected int getDataSize() { return 2 + 2 + 8; @@ -67,4 +74,9 @@ public final class DataLabelExtensionRec buffer.append("[/DATALABEXT]\n"); return buffer.toString(); } + + @Override + public DataLabelExtensionRecord copy() { + return new DataLabelExtensionRecord(this); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java Sun Dec 22 21:44:45 2019 @@ -21,26 +21,28 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** * The default data label text properties record identifies the text characteristics of the preceding text record. */ -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; - public final static short CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC = 1; - public final static short CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC = 2; +public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord { + public static final short sid = 0x1024; + public static final short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0; + public static final short CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC = 1; + public static final short CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC = 2; + private short field_1_categoryDataType; - public DefaultDataLabelTextPropertiesRecord() - { + public DefaultDataLabelTextPropertiesRecord() {} + public DefaultDataLabelTextPropertiesRecord(DefaultDataLabelTextPropertiesRecord other) { + super(other); + field_1_categoryDataType = other.field_1_categoryDataType; } - public DefaultDataLabelTextPropertiesRecord(RecordInputStream in) - { - field_1_categoryDataType = in.readShort(); + public DefaultDataLabelTextPropertiesRecord(RecordInputStream in) { + field_1_categoryDataType = in.readShort(); } public String toString() @@ -51,7 +53,7 @@ public final class DefaultDataLabelTextP buffer.append(" .categoryDataType = ") .append("0x").append(HexDump.toHex( getCategoryDataType ())) .append(" (").append( getCategoryDataType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append("[/DEFAULTTEXT]\n"); return buffer.toString(); @@ -71,20 +73,22 @@ public final class DefaultDataLabelTextP } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public DefaultDataLabelTextPropertiesRecord clone() { - DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord(); - - rec.field_1_categoryDataType = field_1_categoryDataType; - return rec; + return copy(); } - - + @Override + public DefaultDataLabelTextPropertiesRecord copy() { + return new DefaultDataLabelTextPropertiesRecord(this); + } /** * Get the category data type field for the DefaultDataLabelTextProperties record. * - * @return One of + * @return One of * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC @@ -98,7 +102,7 @@ public final class DefaultDataLabelTextP * Set the category data type field for the DefaultDataLabelTextProperties record. * * @param field_1_categoryDataType - * One of + * One of * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/EndRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/EndRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/EndRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/EndRecord.java Sun Dec 22 21:44:45 2019 @@ -20,28 +20,24 @@ package org.apache.poi.hssf.record.chart import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; /** * The end record defines the end of a block of records for a (Graphing) * data object. This record is matched with a corresponding BeginRecord. * * @see BeginRecord - * - * @author Glen Stampoultzis (glens at apache.org) */ -public final class EndRecord extends StandardRecord implements Cloneable { +public final class EndRecord extends StandardRecord { public static final short sid = 0x1034; - public EndRecord() - { - } + public EndRecord() {} /** * @param in unused (since this record has no data) */ - public EndRecord(RecordInputStream in) - { + public EndRecord(RecordInputStream in) { } public String toString() @@ -64,9 +60,17 @@ public final class EndRecord extends Sta { return sid; } - + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public EndRecord clone() { + return copy(); + } + + @Override + public EndRecord copy() { // No data so nothing to copy return new EndRecord(); } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java Sun Dec 22 21:44:45 2019 @@ -21,22 +21,27 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; -/** - * The font basis record stores various font metrics. - */ -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; - private short field_4_scale; - private short field_5_indexToFontTable; - - - public FontBasisRecord() - { - +/** The font basis record stores various font metrics. */ +public final class FontBasisRecord extends StandardRecord { + public static final short sid = 0x1060; + private short field_1_xBasis; + private short field_2_yBasis; + private short field_3_heightBasis; + private short field_4_scale; + private short field_5_indexToFontTable; + + + public FontBasisRecord() {} + + public FontBasisRecord(FontBasisRecord other) { + super(other); + field_1_xBasis = other.field_1_xBasis; + field_2_yBasis = other.field_2_yBasis; + field_3_heightBasis = other.field_3_heightBasis; + field_4_scale = other.field_4_scale; + field_5_indexToFontTable = other.field_5_indexToFontTable; } public FontBasisRecord(RecordInputStream in) @@ -56,23 +61,23 @@ public final class FontBasisRecord exten buffer.append(" .xBasis = ") .append("0x").append(HexDump.toHex( getXBasis ())) .append(" (").append( getXBasis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .yBasis = ") .append("0x").append(HexDump.toHex( getYBasis ())) .append(" (").append( getYBasis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .heightBasis = ") .append("0x").append(HexDump.toHex( getHeightBasis ())) .append(" (").append( getHeightBasis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .scale = ") .append("0x").append(HexDump.toHex( getScale ())) .append(" (").append( getScale() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append(" .indexToFontTable = ") .append("0x").append(HexDump.toHex( getIndexToFontTable ())) .append(" (").append( getIndexToFontTable() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append("[/FBI]\n"); return buffer.toString(); @@ -96,19 +101,17 @@ public final class FontBasisRecord exten } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public FontBasisRecord clone() { - FontBasisRecord rec = new FontBasisRecord(); - - rec.field_1_xBasis = field_1_xBasis; - rec.field_2_yBasis = field_2_yBasis; - rec.field_3_heightBasis = field_3_heightBasis; - rec.field_4_scale = field_4_scale; - rec.field_5_indexToFontTable = field_5_indexToFontTable; - return rec; + return copy(); } - - + @Override + public FontBasisRecord copy() { + return new FontBasisRecord(this); + } /** * Get the x Basis field for the FontBasis record. Modified: poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java?rev=1871911&r1=1871910&r2=1871911&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java Sun Dec 22 21:44:45 2019 @@ -21,25 +21,22 @@ import org.apache.poi.hssf.record.Record import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.Removal; -/** - * The font index record indexes into the font table for the text record.<p> - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class FontIndexRecord extends StandardRecord implements Cloneable { - public final static short sid = 0x1026; - private short field_1_fontIndex; +/** The font index record indexes into the font table for the text record. */ +public final class FontIndexRecord extends StandardRecord { + public static final short sid = 0x1026; + private short field_1_fontIndex; + public FontIndexRecord() {} - public FontIndexRecord() - { - + public FontIndexRecord(FontIndexRecord other) { + super(other); + field_1_fontIndex = other.field_1_fontIndex; } - public FontIndexRecord(RecordInputStream in) - { - field_1_fontIndex = in.readShort(); + public FontIndexRecord(RecordInputStream in) { + field_1_fontIndex = in.readShort(); } public String toString() @@ -50,7 +47,7 @@ public final class FontIndexRecord exten buffer.append(" .fontIndex = ") .append("0x").append(HexDump.toHex( getFontIndex ())) .append(" (").append( getFontIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); + buffer.append(System.getProperty("line.separator")); buffer.append("[/FONTX]\n"); return buffer.toString(); @@ -70,11 +67,16 @@ public final class FontIndexRecord exten } @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public FontIndexRecord clone() { - FontIndexRecord rec = new FontIndexRecord(); - - rec.field_1_fontIndex = field_1_fontIndex; - return rec; + return copy(); + } + + @Override + public FontIndexRecord copy() { + return new FontIndexRecord(this); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org