FileDocCategorySizeDatePackage
AttrPtg.javaAPI DocApache Poi 3.0.16544Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record.formula

AttrPtg

public class AttrPtg extends OperationPtg
"Special Attributes" This seems to be a Misc Stuff and Junk record. One function it serves is in SUM functions (i.e. SUM(A1:A3) causes an area PTG then an ATTR with the SUM option set)
author
andy
author
Jason Height (jheight at chariot dot net dot au)

Fields Summary
public static final byte
sid
private static final int
SIZE
private byte
field_1_options
private short
field_2_data
private BitField
semiVolatile
private BitField
optiIf
private BitField
optiChoose
private BitField
optGoto
private BitField
sum
private BitField
baxcel
private BitField
space
Constructors Summary
public AttrPtg()


      
    
public AttrPtg(RecordInputStream in)

        field_1_options = in.readByte();
        field_2_data    = in.readShort();
    
Methods Summary
public java.lang.Objectclone()

      AttrPtg ptg = new AttrPtg();
      ptg.field_1_options = field_1_options;
      ptg.field_2_data = field_2_data;
      return ptg;
    
public shortgetData()

        return field_2_data;
    
public bytegetDefaultOperandClass()

return Ptg.CLASS_VALUE;
public intgetNumberOfOperands()

        return 1;
    
public bytegetOptions()

        return field_1_options;
    
public intgetSize()

        return SIZE;
    
public intgetType()

        return -1;
    
public booleanisBaxcel()

        return baxcel.isSet(getOptions());
    
public booleanisGoto()

        return optGoto.isSet(getOptions());
    
public booleanisOptimizedChoose()

        return optiChoose.isSet(getOptions());
    
public booleanisOptimizedIf()

        return optiIf.isSet(getOptions());
    
public booleanisSemiVolatile()

        return semiVolatile.isSet(getOptions());
    
public booleanisSpace()

        return space.isSet(getOptions());
    
public booleanisSum()

        return sum.isSet(getOptions());
    
public voidsetData(short data)

        field_2_data = data;
    
public voidsetGoto(boolean isGoto)
Flags this ptg as a goto/jump

param
isGoto

		field_1_options=optGoto.setByteBoolean(field_1_options, isGoto);
	
public voidsetOptimizedIf(boolean bif)

        field_1_options=optiIf.setByteBoolean(field_1_options,bif);
    
public voidsetOptions(byte options)

        field_1_options = options;
    
public voidsetSum(boolean bsum)

        field_1_options=sum.setByteBoolean(field_1_options,bsum);
    
public java.lang.StringtoFormulaString(java.lang.String[] operands)

        if(space.isSet(field_1_options)) {
            return operands[ 0 ];
        } else if (optiIf.isSet(field_1_options)) {
            return toFormulaString((Workbook)null) + "(" + operands[ 0 ]             +")";
        } else if (optGoto.isSet(field_1_options)) {
            return toFormulaString((Workbook)null) + operands[0];   //goto isn't a real formula element should not show up
        } else {
            return toFormulaString((Workbook)null) + "(" + operands[ 0 ] + ")";
        }
    
public java.lang.StringtoFormulaString(org.apache.poi.hssf.model.Workbook 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 java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("AttrPtg\n");
        buffer.append("options=").append(field_1_options).append("\n");
        buffer.append("data   =").append(field_2_data).append("\n");
        buffer.append("semi   =").append(isSemiVolatile()).append("\n");
        buffer.append("optimif=").append(isOptimizedIf()).append("\n");
        buffer.append("optchos=").append(isOptimizedChoose()).append("\n");
        buffer.append("isGoto =").append(isGoto()).append("\n");
        buffer.append("isSum  =").append(isSum()).append("\n");
        buffer.append("isBaxce=").append(isBaxcel()).append("\n");
        buffer.append("isSpace=").append(isSpace()).append("\n");
        return buffer.toString();
    
public voidwriteBytes(byte[] array, int offset)

        array[offset]=sid;
        array[offset+1]=field_1_options;
        LittleEndian.putShort(array,offset+2,field_2_data);