KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > record > formula > DividePtg


1 /* ====================================================================
2    Copyright 2003-2004 Apache Software Foundation
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 ==================================================================== */

16
17
18 package org.apache.poi.hssf.record.formula;
19
20 import java.util.List JavaDoc;
21
22 import org.apache.poi.hssf.model.Workbook;
23
24 /**
25  * This PTG implements the standard binomial divide "/"
26  * @author Andrew C. Oliver acoliver at apache dot org
27  * @author Jason Height (jheight at chariot dot net dot au)
28  */

29
30 public class DividePtg
31     extends OperationPtg
32 {
33     public final static int SIZE = 1;
34     public final static byte sid = 0x06;
35
36     /** Creates new AddPtg */
37
38     public DividePtg()
39     {
40     }
41
42     public DividePtg(byte [] data, int offset)
43     {
44
45         // doesn't need anything
46
}
47
48     public void writeBytes(byte [] array, int offset)
49     {
50         array[ offset + 0 ] = sid;
51     }
52
53     public int getSize()
54     {
55         return SIZE;
56     }
57
58     public int getType()
59     {
60         return TYPE_BINARY;
61     }
62
63     public int getNumberOfOperands()
64     {
65         return 2;
66     }
67
68     public String JavaDoc toFormulaString(Workbook book)
69     {
70         return "/";
71     }
72
73      public String JavaDoc toFormulaString(String JavaDoc[] operands) {
74         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
75
76         buffer.append(operands[ 0 ]);
77         buffer.append(toFormulaString((Workbook)null));
78         buffer.append(operands[ 1 ]);
79         return buffer.toString();
80     }
81
82     public Object JavaDoc clone() {
83       DividePtg ptg = new DividePtg();
84       return ptg;
85     }
86 }
87
Popular Tags