KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.apache.poi.hssf.record.formula;
19
20 import org.apache.poi.hssf.model.Workbook;
21
22 /**
23  *
24  * @author andy
25  */

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