clarification of ArrayPtg size increment

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@694620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-09-12 07:03:00 +00:00
parent 658057a44a
commit 9b9d63275a
1 changed files with 34 additions and 30 deletions

View File

@ -56,20 +56,21 @@ public abstract class Ptg implements Cloneable {
/**
* @deprecated - use readTokens()
*/
public static Stack createParsedExpressionTokens(short size, RecordInputStream in)
{
public static Stack createParsedExpressionTokens(short size, RecordInputStream in) {
Stack stack = new Stack();
int pos = 0;
List arrayPtgs = null;
while ( pos < size )
{
while (pos < size) {
Ptg ptg = Ptg.createPtg( in );
if (ptg instanceof ArrayPtg) {
if (arrayPtgs == null)
if (arrayPtgs == null) {
arrayPtgs = new ArrayList(5);
}
arrayPtgs.add(ptg);
pos += 8;
} else pos += ptg.getSize();
pos += ArrayPtg.PLAIN_TOKEN_SIZE;
} else {
pos += ptg.getSize();
}
stack.push( ptg );
}
if(pos != size) {
@ -262,11 +263,14 @@ public abstract class Ptg implements Cloneable {
ptg.writeBytes(array, pos + offset);
if (ptg instanceof ArrayPtg) {
if (arrayPtgs == null)
if (arrayPtgs == null) {
arrayPtgs = new ArrayList(5);
}
arrayPtgs.add(ptg);
pos += 8;
} else pos += ptg.getSize();
pos += ArrayPtg.PLAIN_TOKEN_SIZE;
} else {
pos += ptg.getSize();
}
}
if (arrayPtgs != null) {
for (int i=0;i<arrayPtgs.size();i++) {