KickJava   Java API By Example, From Geeks To Geeks.

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


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 /*
19  * Ptg.java
20  *
21  * Created on October 28, 2001, 6:30 PM
22  */

23 package org.apache.poi.hssf.record.formula;
24
25 import org.apache.poi.util.LittleEndian;
26 import org.apache.poi.hssf.model.Workbook;
27
28 /**
29  * @author Glen Stampoultzis (glens at apache.org)
30  */

31 public class MemFuncPtg extends ControlPtg
32 {
33
34     public final static byte sid = 0x29;
35     private short field_1_len_ref_subexpression = 0;
36
37     public MemFuncPtg()
38     {
39         //Required for clone methods
40
}
41
42     /**Creates new function pointer from a byte array
43      * usually called while reading an excel file.
44      */

45     public MemFuncPtg( byte[] data, int offset )
46     {
47         offset++;
48         field_1_len_ref_subexpression = LittleEndian.getShort( data, offset + 0 );
49     }
50
51     public int getSize()
52     {
53         return 3;
54     }
55
56     public void writeBytes( byte[] array, int offset )
57     {
58         array[offset + 0] = sid ;
59         LittleEndian.putShort( array, offset + 1, (short)field_1_len_ref_subexpression );
60     }
61
62     public String JavaDoc toFormulaString(Workbook book)
63     {
64         return "";
65     }
66
67     public byte getDefaultOperandClass()
68     {
69         return 0;
70     }
71
72     public int getNumberOfOperands()
73     {
74         return field_1_len_ref_subexpression;
75     }
76
77     public Object JavaDoc clone()
78     {
79         MemFuncPtg ptg = new MemFuncPtg();
80         ptg.field_1_len_ref_subexpression = this.field_1_len_ref_subexpression;
81         return ptg;
82     }
83
84     public int getLenRefSubexpression()
85     {
86         return field_1_len_ref_subexpression;
87     }
88
89     public void setLenRefSubexpression(int len)
90     {
91         field_1_len_ref_subexpression = (short)len;
92     }
93
94 }
Popular Tags