01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: 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: * 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: import org.apache.poi.hssf.record.RecordInputStream;
28:
29: /**
30: * @author Glen Stampoultzis (glens at apache.org)
31: */
32: public class MemFuncPtg extends ControlPtg {
33:
34: public final static byte sid = 0x29;
35: private short field_1_len_ref_subexpression = 0;
36:
37: public MemFuncPtg() {
38: //Required for clone methods
39: }
40:
41: /**Creates new function pointer from a byte array
42: * usually called while reading an excel file.
43: */
44: public MemFuncPtg(RecordInputStream in) {
45: field_1_len_ref_subexpression = in.readShort();
46: }
47:
48: public int getSize() {
49: return 3;
50: }
51:
52: public void writeBytes(byte[] array, int offset) {
53: array[offset + 0] = sid;
54: LittleEndian.putShort(array, offset + 1,
55: (short) field_1_len_ref_subexpression);
56: }
57:
58: public String toFormulaString(Workbook book) {
59: return "";
60: }
61:
62: public byte getDefaultOperandClass() {
63: return 0;
64: }
65:
66: public int getNumberOfOperands() {
67: return field_1_len_ref_subexpression;
68: }
69:
70: public Object clone() {
71: MemFuncPtg ptg = new MemFuncPtg();
72: ptg.field_1_len_ref_subexpression = this .field_1_len_ref_subexpression;
73: return ptg;
74: }
75:
76: public int getLenRefSubexpression() {
77: return field_1_len_ref_subexpression;
78: }
79:
80: public void setLenRefSubexpression(int len) {
81: field_1_len_ref_subexpression = (short) len;
82: }
83:
84: }
|