| Method from org.apache.poi.hssf.record.formula.AttrPtg Detail: |
public Object clone() {
int[] jt;
if (_jumpTable == null) {
jt = null;
} else {
jt = (int[]) _jumpTable.clone();
}
return new AttrPtg(field_1_options, field_2_data, jt, _chooseFuncOffset);
}
|
public static AttrPtg createSpace(int type,
int count) {
int data = type & 0x00FF | (count < < 8) & 0x00FFFF;
return new AttrPtg(space.set(0), data, null, -1);
}
|
public short getData() {
return field_2_data;
}
|
public int getNumberOfOperands() {
return 1;
}
|
public byte getOptions() {
return field_1_options;
}
|
public int getSize() {
if (_jumpTable != null) {
return SIZE + (_jumpTable.length + 1) * LittleEndian.SHORT_SIZE;
}
return SIZE;
}
|
public int getType() {
return -1;
}
|
public boolean isBaxcel() {
return baxcel.isSet(getOptions());
}
|
public boolean isGoto() {
return optGoto.isSet(getOptions());
}
|
public boolean isOptimizedChoose() {
return optiChoose.isSet(getOptions());
}
|
public boolean isOptimizedIf() {
return optiIf.isSet(getOptions());
}
|
public boolean isSemiVolatile() {
return semiVolatile.isSet(getOptions());
}
|
public boolean isSpace() {
return space.isSet(getOptions());
}
|
public boolean isSum() {
return sum.isSet(getOptions());
}
|
public void setData(short data) {
field_2_data = data;
}
|
public void setGoto(boolean isGoto) {
field_1_options=optGoto.setByteBoolean(field_1_options, isGoto);
}
Flags this ptg as a goto/jump |
public void setOptimizedIf(boolean bif) {
field_1_options=optiIf.setByteBoolean(field_1_options,bif);
}
|
public void setOptions(byte options) {
field_1_options = options;
}
|
public void setSum(boolean bsum) {
field_1_options=sum.setByteBoolean(field_1_options,bsum);
}
|
public String toFormulaString(String[] operands) {
if(space.isSet(field_1_options)) {
return operands[ 0 ];
} else if (optiIf.isSet(field_1_options)) {
return toFormulaString((HSSFWorkbook)null) + "(" + operands[ 0 ] +")";
} else if (optGoto.isSet(field_1_options)) {
return toFormulaString((HSSFWorkbook)null) + operands[0]; //goto isn't a real formula element should not show up
} else {
return toFormulaString((HSSFWorkbook)null) + "(" + operands[ 0 ] + ")";
}
}
|
public String toFormulaString(HSSFWorkbook book) {
if(semiVolatile.isSet(field_1_options)) {
return "ATTR(semiVolatile)";
}
if(optiIf.isSet(field_1_options)) {
return "IF";
}
if( optiChoose.isSet(field_1_options)) {
return "CHOOSE";
}
if(optGoto.isSet(field_1_options)) {
return "";
}
if(sum.isSet(field_1_options)) {
return "SUM";
}
if(baxcel.isSet(field_1_options)) {
return "ATTR(baxcel)";
}
if(space.isSet(field_1_options)) {
return "";
}
return "UNKNOWN ATTRIBUTE";
}
|
public String toString() {
StringBuffer sb = new StringBuffer(64);
sb.append(getClass().getName()).append(" [");
if(isSemiVolatile()) {
sb.append("volatile ");
}
if(isSpace()) {
sb.append("space count=").append((field_2_data > > 8) & 0x00FF);
sb.append(" type=").append(field_2_data & 0x00FF).append(" ");
}
// the rest seem to be mutually exclusive
if(isOptimizedIf()) {
sb.append("if dist=").append(getData());
} else if(isOptimizedChoose()) {
sb.append("choose nCases=").append(getData());
} else if(isGoto()) {
sb.append("skip dist=").append(getData());
} else if(isSum()) {
sb.append("sum ");
} else if(isBaxcel()) {
sb.append("assign ");
}
sb.append("]");
return sb.toString();
}
|
public void writeBytes(byte[] array,
int offset) {
LittleEndian.putByte(array, offset+0, sid);
LittleEndian.putByte(array, offset+1, field_1_options);
LittleEndian.putShort(array,offset+2, field_2_data);
int[] jt = _jumpTable;
if (jt != null) {
int joff = offset+4;
LittleEndian.putUShort(array, joff, _chooseFuncOffset);
joff+=2;
for (int i = 0; i < jt.length; i++) {
LittleEndian.putUShort(array, joff, jt[i]);
joff+=2;
}
LittleEndian.putUShort(array, joff, _chooseFuncOffset);
}
}
|