コード例 #1
0
  @Override
  protected void serializeValue(LittleEndianOutput out) {

    if (specialCachedValue == null) {
      out.writeDouble(field_4_value);
    } else {
      specialCachedValue.serialize(out);
    }

    out.writeShort(getOptions());

    out.writeInt(
        field_6_zero); // may as well write original data back so as to minimise differences from
                       // original
    field_8_parsed_expr.serialize(out);
  }
コード例 #2
0
  public FormulaRecord(RecordInputStream ris) {
    super(ris);
    LittleEndianInput in = ris;
    long valueLongBits = in.readLong();
    field_5_options = in.readShort();
    specialCachedValue = SpecialCachedValue.create(valueLongBits);
    if (specialCachedValue == null) {
      field_4_value = Double.longBitsToDouble(valueLongBits);
    }

    field_6_zero = in.readInt();

    int field_7_expression_len =
        in.readShort(); // this length does not include any extra array data
    int nBytesAvailable = in.available();
    field_8_parsed_expr = Formula.read(field_7_expression_len, in, nBytesAvailable);
  }
コード例 #3
0
  @Override
  protected void appendValueText(StringBuilder sb) {
    sb.append("  .value	 = ");
    if (specialCachedValue == null) {
      sb.append(field_4_value).append("\n");
    } else {
      sb.append(specialCachedValue.formatDebugString()).append("\n");
    }
    sb.append("  .options   = ").append(HexDump.shortToHex(getOptions())).append("\n");
    sb.append("    .alwaysCalc= ").append(isAlwaysCalc()).append("\n");
    sb.append("    .calcOnLoad= ").append(isCalcOnLoad()).append("\n");
    sb.append("    .shared    = ").append(isSharedFormula()).append("\n");
    sb.append("  .zero      = ").append(HexDump.intToHex(field_6_zero)).append("\n");

    Ptg[] ptgs = field_8_parsed_expr.getTokens();
    for (int k = 0; k < ptgs.length; k++) {
      if (k > 0) {
        sb.append("\n");
      }
      sb.append("    Ptg[").append(k).append("]=");
      Ptg ptg = ptgs[k];
      sb.append(ptg.toString()).append(ptg.getRVAType());
    }
  }
コード例 #4
0
ファイル: Formula.java プロジェクト: feiwei9696/POI-Android
 /**
  * Gets the {@link Ptg} array from the supplied {@link Formula}. Handles <code>null</code>s OK.
  *
  * @param formula may be <code>null</code>
  * @return possibly <code>null</code> (if the supplied <tt>formula</tt> is <code>null</code>)
  */
 public static Ptg[] getTokens(Formula formula) {
   if (formula == null) {
     return null;
   }
   return formula.getTokens();
 }
コード例 #5
0
 @Override
 protected int getValueDataSize() {
   return FIXED_SIZE + field_8_parsed_expr.getEncodedSize();
 }
コード例 #6
0
 public void setParsedExpression(Ptg[] ptgs) {
   field_8_parsed_expr = Formula.create(ptgs);
 }
コード例 #7
0
 /** @return the formula tokens. never <code>null</code> */
 public Ptg[] getParsedExpression() {
   return field_8_parsed_expr.getTokens();
 }
コード例 #8
0
 /** Creates new FormulaRecord */
 public FormulaRecord() {
   field_8_parsed_expr = Formula.create(Ptg.EMPTY_PTG_ARRAY);
 }