removed TODO comment and formatted
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@683128 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
28313438f6
commit
1459d3eb3b
@ -37,7 +37,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
* @author Danny Mui (dmui at apache dot org)
|
* @author Danny Mui (dmui at apache dot org)
|
||||||
*/
|
*/
|
||||||
public abstract class PageBreakRecord extends Record {
|
public abstract class PageBreakRecord extends Record {
|
||||||
private static final boolean IS_EMPTY_RECORD_WRITTEN = false; //TODO - flip
|
private static final boolean IS_EMPTY_RECORD_WRITTEN = false;
|
||||||
private static final int[] EMPTY_INT_ARRAY = { };
|
private static final int[] EMPTY_INT_ARRAY = { };
|
||||||
|
|
||||||
private List _breaks;
|
private List _breaks;
|
||||||
@ -53,7 +53,7 @@ public abstract class PageBreakRecord extends Record {
|
|||||||
public class Break {
|
public class Break {
|
||||||
|
|
||||||
public static final int ENCODED_SIZE = 6;
|
public static final int ENCODED_SIZE = 6;
|
||||||
public int main;
|
public int main;
|
||||||
public int subFrom;
|
public int subFrom;
|
||||||
public int subTo;
|
public int subTo;
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ public abstract class PageBreakRecord extends Record {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Break(RecordInputStream in) {
|
public Break(RecordInputStream in) {
|
||||||
main = in.readUShort() - 1;
|
main = in.readUShort() - 1;
|
||||||
subFrom = in.readUShort();
|
subFrom = in.readUShort();
|
||||||
subTo = in.readUShort();
|
subTo = in.readUShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int serialize(int offset, byte[] data) {
|
public int serialize(int offset, byte[] data) {
|
||||||
@ -94,20 +94,20 @@ public abstract class PageBreakRecord extends Record {
|
|||||||
_breakMap = new HashMap();
|
_breakMap = new HashMap();
|
||||||
|
|
||||||
for(int k = 0; k < nBreaks; k++) {
|
for(int k = 0; k < nBreaks; k++) {
|
||||||
Break br = new Break(in);
|
Break br = new Break(in);
|
||||||
_breaks.add(br);
|
_breaks.add(br);
|
||||||
_breakMap.put(new Integer(br.main), br);
|
_breakMap.put(new Integer(br.main), br);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getDataSize() {
|
private int getDataSize() {
|
||||||
return 2 + _breaks.size() * Break.ENCODED_SIZE;
|
return 2 + _breaks.size() * Break.ENCODED_SIZE;
|
||||||
}
|
}
|
||||||
public int getRecordSize() {
|
public int getRecordSize() {
|
||||||
int nBreaks = _breaks.size();
|
int nBreaks = _breaks.size();
|
||||||
if (!IS_EMPTY_RECORD_WRITTEN && nBreaks < 1) {
|
if (!IS_EMPTY_RECORD_WRITTEN && nBreaks < 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 4 + getDataSize();
|
return 4 + getDataSize();
|
||||||
}
|
}
|
||||||
@ -116,9 +116,9 @@ public abstract class PageBreakRecord extends Record {
|
|||||||
public final int serialize(int offset, byte data[]) {
|
public final int serialize(int offset, byte data[]) {
|
||||||
int nBreaks = _breaks.size();
|
int nBreaks = _breaks.size();
|
||||||
if (!IS_EMPTY_RECORD_WRITTEN && nBreaks < 1) {
|
if (!IS_EMPTY_RECORD_WRITTEN && nBreaks < 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int dataSize = getDataSize();
|
int dataSize = getDataSize();
|
||||||
LittleEndian.putUShort(data, offset + 0, getSid());
|
LittleEndian.putUShort(data, offset + 0, getSid());
|
||||||
LittleEndian.putUShort(data, offset + 2, dataSize);
|
LittleEndian.putUShort(data, offset + 2, dataSize);
|
||||||
LittleEndian.putUShort(data, offset + 4, nBreaks);
|
LittleEndian.putUShort(data, offset + 4, nBreaks);
|
||||||
@ -217,12 +217,11 @@ public abstract class PageBreakRecord extends Record {
|
|||||||
return (Break)_breakMap.get(rowKey);
|
return (Break)_breakMap.get(rowKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final int[] getBreaks() {
|
public final int[] getBreaks() {
|
||||||
int count = getNumBreaks();
|
int count = getNumBreaks();
|
||||||
if (count < 1) {
|
if (count < 1) {
|
||||||
return EMPTY_INT_ARRAY;
|
return EMPTY_INT_ARRAY;
|
||||||
}
|
}
|
||||||
int[] result = new int[count];
|
int[] result = new int[count];
|
||||||
for (int i=0; i<count; i++) {
|
for (int i=0; i<count; i++) {
|
||||||
Break breakItem = (Break)_breaks.get(i);
|
Break breakItem = (Break)_breaks.get(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user