KickJava   Java API By Example, From Geeks To Geeks.

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


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  * @author Jason Height (jheight at chariot dot net dot au)
26  * @author dmui (save existing implementation)
27  */

28
29 public class ExpPtg
30     extends Ptg
31 {
32     private final static int SIZE = 5;
33     public final static short sid = 0x1;
34      private byte[] existing = null;
35
36     /** Creates new ExpPtg */
37
38     public ExpPtg()
39     {
40     }
41
42     /** Creates new ExpPtg */
43
44     public ExpPtg(byte [] array, int offset)
45     {
46         existing = new byte[this.getSize()];
47         System.arraycopy(array, offset, existing, 0, this.getSize());
48     }
49
50     public void writeBytes(byte [] array, int offset)
51     {
52         if (existing != null) {
53             System.arraycopy(existing, 0, array, offset, existing.length);
54         }
55     }
56
57     public int getSize()
58     {
59         return SIZE;
60     }
61
62     public String JavaDoc toFormulaString(Workbook book)
63     {
64         return "NO IDEA SHARED FORMULA EXP PTG";
65     }
66     
67     public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
68     
69     public Object JavaDoc clone() {
70         //can't clone one that doesnt have data can we??
71
if (this.existing == null) throw new RuntimeException JavaDoc("NO IDEA SHARED FORMULA EXP PTG");
72         
73         return new ExpPtg(this.existing, 0);
74     }
75
76 }
77
Popular Tags