Lines 44-52
Link Here
|
44 |
/** zero based, unsigned 16 bit */ |
44 |
/** zero based, unsigned 16 bit */ |
45 |
private int field_2_last_row; |
45 |
private int field_2_last_row; |
46 |
/** zero based, unsigned 8 bit */ |
46 |
/** zero based, unsigned 8 bit */ |
47 |
private int field_3_first_column; |
47 |
private int field_3_first_column; //BitFields: (first row relative, first col relative, first column number) |
48 |
/** zero based, unsigned 8 bit */ |
48 |
/** zero based, unsigned 8 bit */ |
49 |
private int field_4_last_column; |
49 |
private int field_4_last_column; //BitFields: (last row relative, last col relative, last column number) |
50 |
|
50 |
|
51 |
private final static BitField rowRelative = BitFieldFactory.getInstance(0x8000); |
51 |
private final static BitField rowRelative = BitFieldFactory.getInstance(0x8000); |
52 |
private final static BitField colRelative = BitFieldFactory.getInstance(0x4000); |
52 |
private final static BitField colRelative = BitFieldFactory.getInstance(0x4000); |
Lines 96-101
Link Here
|
96 |
setLastColRelative(firstColRelative); |
96 |
setLastColRelative(firstColRelative); |
97 |
} |
97 |
} |
98 |
} |
98 |
} |
|
|
99 |
|
100 |
/** |
101 |
* Sort the first and last row and columns in-place to the preferred (top left:bottom right) order |
102 |
* Note: Sort only occurs when an instance is constructed or when this method is called. |
103 |
* |
104 |
* <p>For example, <code>$E5:B$10</code> becomes <code>B5:$E$10</code></p> |
105 |
*/ |
106 |
public void sortTopLeftToBottomRight() { |
107 |
if (getFirstRow() > getLastRow()) { |
108 |
//swap first row and last row numbers and relativity |
109 |
//Note: cannot just swap the fields because row relativity is stored in fields 3 and 4 |
110 |
final int firstRow = getFirstRow(); |
111 |
final boolean firstRowRel = isFirstRowRelative(); |
112 |
setFirstRow(getLastRow()); |
113 |
setFirstRowRelative(isLastRowRelative()); |
114 |
setLastRow(firstRow); |
115 |
setLastRowRelative(firstRowRel); |
116 |
} |
117 |
if (getFirstColumn() > getLastColumn()) { |
118 |
//swap first column and last column numbers and relativity |
119 |
//Note: cannot just swap the fields because row relativity is stored in fields 3 and 4 |
120 |
final int firstCol = getFirstColumn(); |
121 |
final boolean firstColRel = isFirstColRelative(); |
122 |
setFirstColumn(getLastColumn()); |
123 |
setFirstColRelative(isLastColRelative()); |
124 |
setLastColumn(firstCol); |
125 |
setLastColRelative(firstColRel); |
126 |
} |
127 |
} |
99 |
|
128 |
|
100 |
protected final void readCoordinates(LittleEndianInput in) { |
129 |
protected final void readCoordinates(LittleEndianInput in) { |
101 |
field_1_first_row = in.readUShort(); |
130 |
field_1_first_row = in.readUShort(); |