View | Details | Raw Unified | Return to bug 39136
Collapse All | Expand All

(-)src/java/org/apache/poi/hssf/record/formula/Ptg.java (+3 lines)
Lines 323-328 Link Here
323
            case UnaryMinusPtg.sid:
323
            case UnaryMinusPtg.sid:
324
                retval=new UnaryMinusPtg(in);
324
                retval=new UnaryMinusPtg(in);
325
                break;
325
                break;
326
            case PercentPtg.sid:
327
                retval=new PercentPtg(in);
328
                break;
326
329
327
            default :
330
            default :
328
331
(-)src/java/org/apache/poi/hssf/record/formula/PercentPtg.java (+96 lines)
Line 0 Link Here
1
2
/* ====================================================================
3
   Copyright 2003-2004   Apache Software Foundation
4
5
   Licensed under the Apache License, Version 2.0 (the "License");
6
   you may not use this file except in compliance with the License.
7
   You may obtain a copy of the License at
8
9
       http://www.apache.org/licenses/LICENSE-2.0
10
11
   Unless required by applicable law or agreed to in writing, software
12
   distributed under the License is distributed on an "AS IS" BASIS,
13
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
   See the License for the specific language governing permissions and
15
   limitations under the License.
16
==================================================================== */
17
18
/*
19
 * PercentPtg.java
20
 *
21
 * Created on March 29, 2006, 9:23 PM
22
 */
23
package org.apache.poi.hssf.record.formula;
24
25
import org.apache.poi.hssf.model.Workbook;
26
import org.apache.poi.hssf.record.RecordInputStream;
27
28
/**
29
 * Percent PTG.
30
 *
31
 * @author Daniel Noll (daniel at nuix.com.au)
32
 */
33
34
public class PercentPtg
35
    extends OperationPtg
36
{
37
    public final static int  SIZE = 1;
38
    public final static byte sid  = 0x14;
39
    
40
    private final static String PERCENT = "%";
41
42
    /** Creates new PercentPtg */
43
44
    public PercentPtg()
45
    {
46
    }
47
48
    public PercentPtg(RecordInputStream in)
49
    {
50
51
        // doesn't need anything
52
    }
53
    
54
   
55
    public void writeBytes(byte [] array, int offset)
56
    {
57
        array[ offset + 0 ] = sid;
58
    }
59
60
    public int getSize()
61
    {
62
        return SIZE;
63
    }
64
65
    public int getType()
66
    {
67
        return TYPE_UNARY;
68
    }
69
70
    public int getNumberOfOperands()
71
    {
72
        return 1;
73
    }
74
    
75
    /** Implementation of method from Ptg */
76
    public String toFormulaString(Workbook book)
77
    {
78
        return "%";
79
    }
80
       
81
   /** implementation of method from OperationsPtg*/  
82
    public String toFormulaString(String[] operands) {
83
        StringBuffer buffer = new StringBuffer();
84
85
        buffer.append(operands[ 0 ]);
86
        buffer.append(PERCENT);
87
        return buffer.toString();
88
    }
89
    
90
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
91
           
92
    public Object clone() {
93
      return new PercentPtg();
94
    }
95
96
}
0
  + *
97
  + *

Return to bug 39136