Skip to content

Commit

Permalink
0.3 bugfixes mangesh (#127)
Browse files Browse the repository at this point in the history
* More constructors.

* Add constructor for ptgs
Fixed #120
  • Loading branch information
mangeshbendre authored Sep 19, 2017
1 parent 6df9259 commit 3788b44
Show file tree
Hide file tree
Showing 29 changed files with 141 additions and 37 deletions.
3 changes: 3 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/Area3DPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class Area3DPtg extends AreaPtgBase implements WorkbookDependentFormula,

private int field_1_index_extern_sheet;

public Area3DPtg(){
/* For seralization */
}

public Area3DPtg(String arearef, int externIdx) {
super(new AreaReference(arearef));
Expand Down
5 changes: 5 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/AreaNPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class AreaNPtg extends Area2DPtgBase {
public final static short sid = 0x2D;


public AreaNPtg(){
/* For seralization */
}

public AreaNPtg(LittleEndianInput in) {
super(in);
}
Expand Down
17 changes: 11 additions & 6 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/ArrayPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ public final class ArrayPtg extends Ptg {
public static final int PLAIN_TOKEN_SIZE = 1+RESERVED_FIELD_LEN;

// 7 bytes of data (stored as an int, short and byte here)
private final int _reserved0Int;
private final int _reserved1Short;
private final int _reserved2Byte;
private int _reserved0Int;
private int _reserved1Short;
private int _reserved2Byte;

// data from these fields comes after the Ptg data of all tokens in current formula
private final int _nColumns;
private final int _nRows;
private final Object[] _arrayValues;
private int _nColumns;
private int _nRows;
private Object[] _arrayValues;


public ArrayPtg(){
/* For seralization */
}

ArrayPtg(int reserved0, int reserved1, int reserved2, int nColumns, int nRows, Object[] arrayValues) {
_reserved0Int = reserved0;
Expand Down
5 changes: 2 additions & 3 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/BoolPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ public final class BoolPtg extends ScalarConstantPtg {

private boolean _value;

BoolPtg()
{

BoolPtg() {
/* For seralization */
}

private BoolPtg(boolean b) {
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/ControlPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public abstract class ControlPtg extends Ptg {

public ControlPtg(){
/* For seralization */
}

public boolean isBaseToken() {
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/DeferredNamePtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public class DeferredNamePtg extends OperandPtg implements WorkbookDependentForm

private String namename;

public DeferredNamePtg(){
/* For seralization */
}

public DeferredNamePtg(String name) {
this.namename = name;
}
Expand Down
14 changes: 9 additions & 5 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/DeletedArea3DPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public final class DeletedArea3DPtg extends OperandPtg implements WorkbookDependentFormula {
public final static byte sid = 0x3d;
private final int field_1_index_extern_sheet;
private final int unused1;
private final int unused2;
private int field_1_index_extern_sheet;
private int unused1;
private int unused2;

private final Area3DPtg ptg; //ZSS-759 for render formula string
private final String bookName; //ZSS-759 for render formula string
private Area3DPtg ptg; //ZSS-759 for render formula string
private String bookName; //ZSS-759 for render formula string

public DeletedArea3DPtg(){
/* For seralization */
}

public DeletedArea3DPtg(int externSheetIndex) {
field_1_index_extern_sheet = externSheetIndex;
Expand Down
14 changes: 9 additions & 5 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/DeletedRef3DPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public final class DeletedRef3DPtg extends OperandPtg implements WorkbookDependentFormula {
public final static byte sid = 0x3c;
private final int field_1_index_extern_sheet;
private final int unused1;

private final Ref3DPtg ptg; //ZSS-759 for render formula string
private final String bookName; //ZSS-759 for render formula string
private int field_1_index_extern_sheet;
private int unused1;

private Ref3DPtg ptg; //ZSS-759 for render formula string
private String bookName; //ZSS-759 for render formula string

public DeletedRef3DPtg(){
/* For seralization */
}

/** Creates new DeletedRef3DPtg */
public DeletedRef3DPtg(LittleEndianInput in) {
field_1_index_extern_sheet = in.readUShort();
Expand Down
8 changes: 6 additions & 2 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/ExpPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class ExpPtg extends ControlPtg {
private final static int SIZE = 5;
public final static short sid = 0x1;
private final int field_1_first_row;
private final int field_2_first_col;
private int field_1_first_row;
private int field_2_first_col;

public ExpPtg(){
/* For seralization */
}

public ExpPtg(LittleEndianInput in) {
field_1_first_row = in.readShort();
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/FuncPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public final class FuncPtg extends AbstractFunctionPtg {
public final static byte sid = 0x21;
public final static int SIZE = 3;

public FuncPtg(){
/* For seralization */
}

public static FuncPtg create(LittleEndianInput in) {
return create(in.readUShort());
}
Expand Down
9 changes: 7 additions & 2 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/MemAreaPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class MemAreaPtg extends OperandPtg {
public final static short sid = 0x26;
private final static int SIZE = 7;
private final int field_1_reserved;
private final int field_2_subex_len;
private int field_1_reserved;
private int field_2_subex_len;


public MemAreaPtg(){
/* For seralization */
}

/** Creates new MemAreaPtg */

Expand Down
5 changes: 5 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/MemErrPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public final class MemErrPtg extends OperandPtg {
private int field_1_reserved;
private short field_2_subex_len;


public MemErrPtg(){
/* For seralization */
}

public MemErrPtg(LittleEndianInput in) {
field_1_reserved = in.readInt();
field_2_subex_len = in.readShort();
Expand Down
5 changes: 4 additions & 1 deletion zpoi/src/org/zkoss/poi/ss/formula/ptg/MemFuncPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class MemFuncPtg extends OperandPtg {

public final static byte sid = 0x29;
private final int field_1_len_ref_subexpression;
private int field_1_len_ref_subexpression;

public MemFuncPtg(){
/* For seralization */
}
/**
* Creates new function pointer from a byte array usually called while
* reading an excel file.
Expand Down
4 changes: 3 additions & 1 deletion zpoi/src/org/zkoss/poi/ss/formula/ptg/MultiplyPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public final class MultiplyPtg extends ValueOperatorPtg {
// private MultiplyPtg() {
// // enforce singleton
// }
public MultiplyPtg() {};
public MultiplyPtg() {
/* For seralization */
}

@Override
public OperationPtg getInstance() {
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/NamePtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public class NamePtg extends OperandPtg implements WorkbookDependentFormula {
private int field_1_label_index;
private short field_2_zero; // reserved must be 0

public NamePtg(){
/* For seralization */
}

/**
* @param nameIndex zero-based index to name within workbook
*/
Expand Down
11 changes: 8 additions & 3 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/NameXPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ public final class NameXPtg extends OperandPtg implements WorkbookDependentFormu
private final static int SIZE = 7;

/** index to REF entry in externsheet record */
private final int _sheetRefIndex;
private int _sheetRefIndex;
/** index to defined name or externname table(1 based) */
private final int _nameNumber;
private int _nameNumber;
/** reserved must be 0 */
private final int _reserved;
private int _reserved;


public NameXPtg(){
/* For seralization */
}

private NameXPtg(int sheetRefIndex, int nameNumber, int reserved) {
_sheetRefIndex = sheetRefIndex;
Expand Down
5 changes: 2 additions & 3 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/NumberPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public NumberPtg(LittleEndianInput in) {
this(in.readDouble());
}

NumberPtg()
{

NumberPtg() {
/* For seralization */
}

/**
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/OpTableColRefPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class OpTableColRefPtg extends Ptg {
private int _columnNum = -1;
private String _columnName = "";

public OpTableColRefPtg(){
/* For seralization */
}

public OpTableColRefPtg(String arg1, String arg2) {

String[] first = arg1.split("_");
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/OpTableRefPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class OpTableRefPtg extends Ptg {

private int _tableNum = -1;

public OpTableRefPtg(){
/* For seralization */
}

public OpTableRefPtg(int tableNum) {
_tableNum = tableNum;
}
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/OperandPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public abstract class OperandPtg extends Ptg implements Cloneable {

public OperandPtg(){
/* For seralization */
}

/**
* All Operand {@link Ptg}s are classified ('relative', 'value', 'array')
*/
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/OperationPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public abstract class OperationPtg extends Ptg {
private boolean isOverrided = false;
private int overrideTableNum = 0;

public OperationPtg(){
/* For seralization */
}

public abstract OperationPtg getInstance();

/**
Expand Down
4 changes: 3 additions & 1 deletion zpoi/src/org/zkoss/poi/ss/formula/ptg/Ptg.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public abstract class Ptg implements Serializable{
private static final long serialVersionUID = -5877373845194532264L;
public static final Ptg[] EMPTY_PTG_ARRAY = { };


public Ptg(){
/* For seralization */
}
/**
* Reads <tt>size</tt> bytes of the input stream, to create an array of <tt>Ptg</tt>s.
* Extra data (beyond <tt>size</tt>) may be read if and <tt>ArrayPtg</tt>s are present.
Expand Down
3 changes: 3 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/Ref3DPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public final class Ref3DPtg extends RefPtgBase implements WorkbookDependentFormu
private final static int SIZE = 7; // 6 + 1 for Ptg
private int field_1_index_extern_sheet;

public Ref3DPtg(){
/* For seralization */
}

public Ref3DPtg(LittleEndianInput in) {
field_1_index_extern_sheet = in.readShort();
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/RefNPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class RefNPtg extends Ref2DPtgBase {
public final static byte sid = 0x2C;

public RefNPtg(){
/* For seralization */
}

public RefNPtg(LittleEndianInput in) {
super(in);
}
Expand Down
7 changes: 6 additions & 1 deletion zpoi/src/org/zkoss/poi/ss/formula/ptg/ScalarConstantPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ Licensed to the Apache Software Foundation (ASF) under one or more
* @author Josh Micich
*/
public abstract class ScalarConstantPtg extends Ptg {
public final boolean isBaseToken() {

public ScalarConstantPtg(){
/* For seralization */
}

public final boolean isBaseToken() {
return true;
}

Expand Down
6 changes: 5 additions & 1 deletion zpoi/src/org/zkoss/poi/ss/formula/ptg/TablePtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ public class TablePtg extends Area3DPtg { //ZSS-1013
private Item[] _items;
private String[] _columns;

final private boolean _inTable;
private boolean _inTable;

public TablePtg(){
/* For seralization */
}
public TablePtg(int extIdx, int firstRow, int lastRow, int firstColumn, int lastColumn,
String tableName, Item[] items, String[] columns, boolean inTable) {
super(firstRow, lastRow, firstColumn, lastColumn, false, false, false, false, extIdx); //ZSS-1013
Expand Down
7 changes: 5 additions & 2 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/TblPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ public final class TblPtg extends ControlPtg {
private final static int SIZE = 5;
public final static short sid = 0x02;
/** The row number of the upper left corner */
private final int field_1_first_row;
private int field_1_first_row;
/** The column number of the upper left corner */
private final int field_2_first_col;
private int field_2_first_col;

public TblPtg(){
/* For seralization */
}
public TblPtg(LittleEndianInput in) {
field_1_first_row = in.readUShort();
field_2_first_col = in.readUShort();
Expand Down
6 changes: 5 additions & 1 deletion zpoi/src/org/zkoss/poi/ss/formula/ptg/UnknownPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public class UnknownPtg extends Ptg {
private short size = 1;
private final int _sid;
private int _sid;

public UnknownPtg(){
/* For seralization */
}

public UnknownPtg(int sid) {
_sid = sid;
Expand Down
4 changes: 4 additions & 0 deletions zpoi/src/org/zkoss/poi/ss/formula/ptg/ValueOperatorPtg.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public abstract class ValueOperatorPtg extends OperationPtg {


public ValueOperatorPtg(){
/* For seralization */
}
/**
* All Operator <tt>Ptg</tt>s are base tokens (i.e. are not RVA classified)
*/
Expand Down

0 comments on commit 3788b44

Please sign in to comment.