poi/src/java/org/apache/poi/hssf/record/formula/ParenthesisPtg.java

59 lines
1.9 KiB
Java
Raw Normal View History

/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record.formula;
Merged revisions 707486,707519,707525,707534,707541-707542,707551,707585,707729,707778,707780,707802 via svnmerge from https://svn.apache.org/repos/asf/poi/trunk ........ r707486 | josh | 2008-10-23 15:28:05 -0700 (Thu, 23 Oct 2008) | 1 line Converted Ptgs to use LittleEndianOutput ........ r707519 | josh | 2008-10-23 17:58:49 -0700 (Thu, 23 Oct 2008) | 1 line Fix for unicode string bug in StyleRecord. Improvements to WriteAccessRecord. ........ r707525 | josh | 2008-10-23 19:08:47 -0700 (Thu, 23 Oct 2008) | 1 line Further conversion of Ptg classes to use LittleEndian input/output interfaces ........ r707534 | josh | 2008-10-23 20:47:42 -0700 (Thu, 23 Oct 2008) | 1 line added LittleEndianByteArrayInputStream ........ r707541 | josh | 2008-10-23 21:30:38 -0700 (Thu, 23 Oct 2008) | 1 line Removed String methods from LittleEndianInput ........ r707542 | josh | 2008-10-23 21:40:37 -0700 (Thu, 23 Oct 2008) | 1 line removing unused code ........ r707551 | josh | 2008-10-23 22:46:29 -0700 (Thu, 23 Oct 2008) | 1 line Simplification and code clean-up ........ r707585 | josh | 2008-10-24 01:58:00 -0700 (Fri, 24 Oct 2008) | 1 line General clean-up in LittleEndian util class. (Some optimization, some obsolete code removal) ........ r707729 | josh | 2008-10-24 12:25:11 -0700 (Fri, 24 Oct 2008) | 1 line Fixed test suite name ........ r707778 | josh | 2008-10-24 16:13:44 -0700 (Fri, 24 Oct 2008) | 1 line Optimisation of RecordInputStream - removed intermediate 8K byte buffer. Expected performance gain was not realised immediately, so LittleEndianInput stuff has been pushed down into DocumentInputStream to help. ........ r707780 | josh | 2008-10-24 16:19:26 -0700 (Fri, 24 Oct 2008) | 1 line should have been submitted with c707778 ........ r707802 | josh | 2008-10-24 18:02:37 -0700 (Fri, 24 Oct 2008) | 1 line Further simplification to RecordInputStream. Mostly regarding Strings, ContinueRecords and LittleEndianInput ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@707945 13f79535-47bb-0310-9956-ffa450edef68
2008-10-26 03:18:17 -04:00
import org.apache.poi.util.LittleEndianOutput;
/**
Merged revisions 707486,707519,707525,707534,707541-707542,707551,707585,707729,707778,707780,707802 via svnmerge from https://svn.apache.org/repos/asf/poi/trunk ........ r707486 | josh | 2008-10-23 15:28:05 -0700 (Thu, 23 Oct 2008) | 1 line Converted Ptgs to use LittleEndianOutput ........ r707519 | josh | 2008-10-23 17:58:49 -0700 (Thu, 23 Oct 2008) | 1 line Fix for unicode string bug in StyleRecord. Improvements to WriteAccessRecord. ........ r707525 | josh | 2008-10-23 19:08:47 -0700 (Thu, 23 Oct 2008) | 1 line Further conversion of Ptg classes to use LittleEndian input/output interfaces ........ r707534 | josh | 2008-10-23 20:47:42 -0700 (Thu, 23 Oct 2008) | 1 line added LittleEndianByteArrayInputStream ........ r707541 | josh | 2008-10-23 21:30:38 -0700 (Thu, 23 Oct 2008) | 1 line Removed String methods from LittleEndianInput ........ r707542 | josh | 2008-10-23 21:40:37 -0700 (Thu, 23 Oct 2008) | 1 line removing unused code ........ r707551 | josh | 2008-10-23 22:46:29 -0700 (Thu, 23 Oct 2008) | 1 line Simplification and code clean-up ........ r707585 | josh | 2008-10-24 01:58:00 -0700 (Fri, 24 Oct 2008) | 1 line General clean-up in LittleEndian util class. (Some optimization, some obsolete code removal) ........ r707729 | josh | 2008-10-24 12:25:11 -0700 (Fri, 24 Oct 2008) | 1 line Fixed test suite name ........ r707778 | josh | 2008-10-24 16:13:44 -0700 (Fri, 24 Oct 2008) | 1 line Optimisation of RecordInputStream - removed intermediate 8K byte buffer. Expected performance gain was not realised immediately, so LittleEndianInput stuff has been pushed down into DocumentInputStream to help. ........ r707780 | josh | 2008-10-24 16:19:26 -0700 (Fri, 24 Oct 2008) | 1 line should have been submitted with c707778 ........ r707802 | josh | 2008-10-24 18:02:37 -0700 (Fri, 24 Oct 2008) | 1 line Further simplification to RecordInputStream. Mostly regarding Strings, ContinueRecords and LittleEndianInput ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@707945 13f79535-47bb-0310-9956-ffa450edef68
2008-10-26 03:18:17 -04:00
* While formula tokens are stored in RPN order and thus do not need parenthesis
* for precedence reasons, Parenthesis tokens ARE written to ensure that user
* entered parenthesis are displayed as-is on reading back
*
* Avik Sengupta <lists@aviksengupta.com> Andrew C. Oliver (acoliver at
* apache dot org)
*
* @author Jason Height (jheight at chariot dot net dot au)
*/
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-639241,639243-639253,639255-639486,639488-639601,639603-639835,639837-639917,639919-640056,640058-640710,640712-641156,641158-641184,641186-641795,641797-641798,641800-641933,641935-641963,641965-641966,641968-641995,641997-642230,642232-642562,642564-642565,642568-642570,642572-642573,642576-642736,642739-642877,642879,642881-642890,642892-642903,642905-642945,642947-643624,643626-643653,643655-643669,643671,643673-643830,643832-643833,643835-644342,644344-644472,644474-644508,644510-645347,645349-645351,645353-645559,645561-645565,645568-645951,645953-646193,646195-646311,646313-646404,646406-646665,646667-646853,646855-646869,646871-647151,647153-647185,647187-647277,647279-647566,647568-647573,647575,647578-647711,647714-647737,647739-647823,647825-648155,648157-648202,648204-648273,648275,648277-648302,648304-648333,648335-648588,648590-648622,648625-648673,648675-649141,649144,649146-649556,649558-649795,649799,649801-649910,649912-649913,649915-650128,650131-650132,650134-650137,650140-650914,650916-651991,651993-652284,652286-652287,652289,652291,652293-652297,652299-652328,652330-652425,652427-652445,652447-652560,652562-652933,652935,652937-652993,652995-653116,653118-653124,653126-653483,653487-653519,653522-653550,653552-653607,653609-653667,653669-653674,653676-653814,653817-653830,653832-653891,653893-653944,653946-654055,654057-654355,654357-654365,654367-654648,654651-655215,655217-655277,655279-655281,655283-655911,655913-656212,656214,656216-656251,656253-656698,656700-656756,656758-656892,656894-657135,657137-657165,657168-657179,657181-657354,657356-657357,657359-657701,657703-657874,657876-658032,658034-658284,658286,658288-658301,658303-658307,658309-658321,658323-658335,658337-658348,658351,658353-658832,658834-658983,658985,658987-659066,659068-659402,659404-659428,659430-659451,659453-659454,659456-659461,659463-659477,659479-659524,659526-659571,659574-660890 via svnmerge from https://svn.apache.org/repos/asf/poi/trunk ........ r659575 | nick | 2008-05-23 16:55:08 +0100 (Fri, 23 May 2008) | 1 line Help for bug #44840 - Improved handling of HSSFObjectData, especially for entries with data held not in POIFS ........ r660256 | josh | 2008-05-26 19:02:23 +0100 (Mon, 26 May 2008) | 1 line Follow-on fix for bug 42564 (r653668). Array elements are stored internally column by column. ........ r660263 | josh | 2008-05-26 19:25:02 +0100 (Mon, 26 May 2008) | 1 line Small fix for FormulaParser. Need case-insentive match for IF function name ........ r660280 | josh | 2008-05-26 20:36:56 +0100 (Mon, 26 May 2008) | 1 line Added test cases for parsing IF expressions. Segregated IF test cases into a new class ........ r660344 | josh | 2008-05-27 01:57:23 +0100 (Tue, 27 May 2008) | 1 line Changed class hierarchy of Ptg to improve 'operand class' transformation. ........ r660474 | nick | 2008-05-27 12:44:49 +0100 (Tue, 27 May 2008) | 1 line X, Y, Width and Height getters/setters on HSSFChart ........ r660828 | josh | 2008-05-28 07:19:31 +0100 (Wed, 28 May 2008) | 1 line Fix for 45060 (and 45041) - Improved token class transformation during formula parsing ........ r660834 | yegor | 2008-05-28 07:50:35 +0100 (Wed, 28 May 2008) | 1 line bump 3.1-beta2 announcement ........ r660889 | nick | 2008-05-28 11:03:00 +0100 (Wed, 28 May 2008) | 1 line Fix bug #45087 - Correctly detect date formats like [Black]YYYY as being date based ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@660905 13f79535-47bb-0310-9956-ffa450edef68
2008-05-28 07:06:34 -04:00
public final class ParenthesisPtg extends ControlPtg {
Merged revisions 707486,707519,707525,707534,707541-707542,707551,707585,707729,707778,707780,707802 via svnmerge from https://svn.apache.org/repos/asf/poi/trunk ........ r707486 | josh | 2008-10-23 15:28:05 -0700 (Thu, 23 Oct 2008) | 1 line Converted Ptgs to use LittleEndianOutput ........ r707519 | josh | 2008-10-23 17:58:49 -0700 (Thu, 23 Oct 2008) | 1 line Fix for unicode string bug in StyleRecord. Improvements to WriteAccessRecord. ........ r707525 | josh | 2008-10-23 19:08:47 -0700 (Thu, 23 Oct 2008) | 1 line Further conversion of Ptg classes to use LittleEndian input/output interfaces ........ r707534 | josh | 2008-10-23 20:47:42 -0700 (Thu, 23 Oct 2008) | 1 line added LittleEndianByteArrayInputStream ........ r707541 | josh | 2008-10-23 21:30:38 -0700 (Thu, 23 Oct 2008) | 1 line Removed String methods from LittleEndianInput ........ r707542 | josh | 2008-10-23 21:40:37 -0700 (Thu, 23 Oct 2008) | 1 line removing unused code ........ r707551 | josh | 2008-10-23 22:46:29 -0700 (Thu, 23 Oct 2008) | 1 line Simplification and code clean-up ........ r707585 | josh | 2008-10-24 01:58:00 -0700 (Fri, 24 Oct 2008) | 1 line General clean-up in LittleEndian util class. (Some optimization, some obsolete code removal) ........ r707729 | josh | 2008-10-24 12:25:11 -0700 (Fri, 24 Oct 2008) | 1 line Fixed test suite name ........ r707778 | josh | 2008-10-24 16:13:44 -0700 (Fri, 24 Oct 2008) | 1 line Optimisation of RecordInputStream - removed intermediate 8K byte buffer. Expected performance gain was not realised immediately, so LittleEndianInput stuff has been pushed down into DocumentInputStream to help. ........ r707780 | josh | 2008-10-24 16:19:26 -0700 (Fri, 24 Oct 2008) | 1 line should have been submitted with c707778 ........ r707802 | josh | 2008-10-24 18:02:37 -0700 (Fri, 24 Oct 2008) | 1 line Further simplification to RecordInputStream. Mostly regarding Strings, ContinueRecords and LittleEndianInput ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@707945 13f79535-47bb-0310-9956-ffa450edef68
2008-10-26 03:18:17 -04:00
private final static int SIZE = 1;
public final static byte sid = 0x15;
public static final ControlPtg instance = new ParenthesisPtg();
private ParenthesisPtg() {
// enforce singleton
}
public void write(LittleEndianOutput out) {
out.writeByte(sid + getPtgClass());
}
public int getSize() {
return SIZE;
}
public String toFormulaString() {
return "()";
}
public String toFormulaString(String[] operands) {
return "(" + operands[0] + ")";
}
}