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: * MemAreaPtg.java
20: *
21: * Created on November 21, 2001, 8:46 AM
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 Daniel Noll (daniel at nuix dot com dot au)
31: */
32: public class MemAreaPtg extends Ptg {
33: public final static short sid = 0x26;
34: private final static int SIZE = 7;
35: private int field_1_reserved;
36: private short field_2_subex_len;
37:
38: /** Creates new MemAreaPtg */
39:
40: public MemAreaPtg() {
41: }
42:
43: public MemAreaPtg(RecordInputStream in) {
44: field_1_reserved = in.readInt();
45: field_2_subex_len = in.readShort();
46: }
47:
48: public void setReserved(int res) {
49: field_1_reserved = res;
50: }
51:
52: public int getReserved() {
53: return field_1_reserved;
54: }
55:
56: public void setSubexpressionLength(short subexlen) {
57: field_2_subex_len = subexlen;
58: }
59:
60: public short getSubexpressionLength() {
61: return field_2_subex_len;
62: }
63:
64: public void writeBytes(byte[] array, int offset) {
65: array[offset] = (byte) (sid + ptgClass);
66: LittleEndian.putInt(array, offset + 1, field_1_reserved);
67: LittleEndian.putShort(array, offset + 5, field_2_subex_len);
68: }
69:
70: public int getSize() {
71: return SIZE;
72: }
73:
74: public String toFormulaString(Workbook book) {
75: return ""; // TODO: Not sure how to format this. -- DN
76: }
77:
78: public byte getDefaultOperandClass() {
79: return Ptg.CLASS_VALUE;
80: }
81:
82: public Object clone() {
83: MemAreaPtg ptg = new MemAreaPtg();
84: ptg.field_1_reserved = field_1_reserved;
85: ptg.field_2_subex_len = field_2_subex_len;
86: return ptg;
87: }
88: }
|