KickJava   Java API By Example, From Geeks To Geeks.

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


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
19 package org.apache.poi.hssf.record.formula;
20
21
22 import org.apache.poi.hssf.model.Workbook;
23
24
25 /**
26  * Ptg class to implement less than or equal
27  *
28  * @author fred at stsci dot edu
29  */

30 public class LessEqualPtg
31         extends OperationPtg
32 {
33     public final static int SIZE = 1;
34     public final static byte sid = 0x0a;
35
36     /**
37      * Creates new LessEqualPtg
38      */

39     public LessEqualPtg()
40     {
41
42     }
43
44     public LessEqualPtg( byte[] data, int offset )
45     {
46         // doesn't need anything
47
}
48
49     public void writeBytes( byte[] array, int offset )
50     {
51         array[offset + 0] = sid;
52     }
53
54     public int getSize()
55     {
56         return SIZE;
57     }
58
59     public int getType()
60     {
61         return TYPE_BINARY;
62     }
63
64     public int getNumberOfOperands()
65     {
66         return 2;
67     }
68
69     public String JavaDoc toFormulaString( Workbook book )
70     {
71         return "<=";
72     }
73
74     public String JavaDoc toFormulaString( String JavaDoc[] operands )
75     {
76         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
77         buffer.append( operands[0] );
78         buffer.append( toFormulaString( (Workbook) null ) );
79         buffer.append( operands[1] );
80         return buffer.toString();
81     }
82
83     public Object JavaDoc clone()
84     {
85         return new LessEqualPtg();
86     }
87 }
88
Popular Tags