Removed generic type parameter from OperandPtg because it was not worth the extra syntax.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@887432 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2009-12-04 23:05:06 +00:00
parent 436965d98b
commit 9fb5841de3
8 changed files with 14 additions and 16 deletions

View File

@ -130,9 +130,9 @@ public final class SharedFormulaRecord extends SharedValueRecordBase {
areaNPtg.isFirstColRelative(),
areaNPtg.isLastColRelative());
ptg.setClass(originalOperandClass);
} else if (ptg instanceof OperandPtg<?>) {
} else if (ptg instanceof OperandPtg) {
// Any subclass of OperandPtg is mutable, so it's safest to not share these instances.
ptg = ((OperandPtg<?>) ptg).copy();
ptg = ((OperandPtg) ptg).copy();
} else {
// all other Ptgs are immutable and can be shared
}

View File

@ -75,7 +75,7 @@ public final class TextObjectRecord extends ContinuableRecord {
*/
private int _unknownPreFormulaInt;
/** expect tRef, tRef3D, tArea, tArea3D or tName */
private OperandPtg<?> _linkRefPtg;
private OperandPtg _linkRefPtg;
/**
* Not clear if needed . Excel seems to be OK if this byte is not present.
* Value is often the same as the earlier firstColumn byte. */
@ -108,7 +108,7 @@ public final class TextObjectRecord extends ContinuableRecord {
throw new RecordFormatException("Read " + ptgs.length
+ " tokens but expected exactly 1");
}
_linkRefPtg = (OperandPtg<?>) ptgs[0];
_linkRefPtg = (OperandPtg) ptgs[0];
if (in.remaining() > 0) {
_unknownPostFormulaByte = Byte.valueOf(in.readByte());
} else {

View File

@ -32,7 +32,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author avik
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class Area3DPtg extends AreaPtgBase<Area3DPtg> implements WorkbookDependentFormula, ExternSheetReferenceToken {
public final class Area3DPtg extends AreaPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken {
public final static byte sid = 0x3b;
private final static int SIZE = 11; // 10 + 1 for Ptg

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public abstract class AreaPtgBase<Z extends AreaPtgBase<Z>> extends OperandPtg<Z> implements AreaI {
public abstract class AreaPtgBase extends OperandPtg implements AreaI {
/**
* TODO - (May-2008) fix subclasses of AreaPtg 'AreaN~' which are used in shared formulas.
* see similar comment in ReferencePtg

View File

@ -17,11 +17,10 @@
package org.apache.poi.hssf.record.formula;
/**
* @author Josh Micich
*/
public abstract class OperandPtg<Y extends OperandPtg<Y>> extends Ptg implements Cloneable {
public abstract class OperandPtg extends Ptg implements Cloneable {
/**
* All Operand {@link Ptg}s are classified ('relative', 'value', 'array')
@ -29,11 +28,9 @@ public abstract class OperandPtg<Y extends OperandPtg<Y>> extends Ptg implements
public final boolean isBaseToken() {
return false;
}
public final Y copy() {
public final OperandPtg copy() {
try {
@SuppressWarnings("unchecked")
Y result = (Y) clone();
return result;
return (OperandPtg) clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}

View File

@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Libin Roman (Vista Portal LDT. Developer)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class Ref3DPtg extends RefPtgBase<Ref3DPtg> implements WorkbookDependentFormula, ExternSheetReferenceToken {
public final class Ref3DPtg extends RefPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken {
public final static byte sid = 0x3a;
private final static int SIZE = 7; // 6 + 1 for Ptg

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Andrew C. Oliver (acoliver@apache.org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public abstract class RefPtgBase<Z extends RefPtgBase<Z>> extends OperandPtg<Z> {
public abstract class RefPtgBase extends OperandPtg {
/** The row index - zero based unsigned 16 bit value */
private int field_1_row;

View File

@ -58,6 +58,7 @@ import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
import org.apache.poi.hssf.record.formula.Area3DPtg;
import org.apache.poi.hssf.record.formula.MemFuncPtg;
import org.apache.poi.hssf.record.formula.NameXPtg;
import org.apache.poi.hssf.record.formula.OperandPtg;
import org.apache.poi.hssf.record.formula.Ptg;
import org.apache.poi.hssf.record.formula.Ref3DPtg;
import org.apache.poi.hssf.record.formula.SheetNameFormatter;
@ -678,11 +679,11 @@ public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.userm
Ptg ptg = ptgs[i];
if (ptg instanceof Area3DPtg) {
Area3DPtg a3p = ((Area3DPtg) ptg).copy();
Area3DPtg a3p = (Area3DPtg) ((OperandPtg) ptg).copy();
a3p.setExternSheetIndex(newExtSheetIx);
ptgs[i] = a3p;
} else if (ptg instanceof Ref3DPtg) {
Ref3DPtg r3p = ((Ref3DPtg) ptg).copy();
Ref3DPtg r3p = (Ref3DPtg) ((OperandPtg) ptg).copy();
r3p.setExternSheetIndex(newExtSheetIx);
ptgs[i] = r3p;
}