View | Details | Raw Unified | Return to bug 58441
Collapse All | Expand All

(-)src/java/org/apache/poi/ss/util/CellRangeAddressBase.java (+32 lines)
Lines 164-167 Link Here
164
		CellReference crB = new CellReference(_lastRow, _lastCol);
164
		CellReference crB = new CellReference(_lastRow, _lastCol);
165
		return getClass().getName() + " [" + crA.formatAsString() + ":" + crB.formatAsString() +"]";
165
		return getClass().getName() + " [" + crA.formatAsString() + ":" + crB.formatAsString() +"]";
166
	}
166
	}
167
	
168
	// In case _firstRow > _lastRow or _firstCol > _lastCol
169
	protected int getMinRow() {
170
		return Math.min(_firstRow, _lastRow);
171
	}
172
	protected int getMaxRow() {
173
		return Math.max(_firstRow, _lastRow);
174
	}
175
	protected int getMinColumn() {
176
		return Math.min(_firstCol, _lastCol);
177
	}
178
	protected int getMaxColumn() {
179
		return Math.max(_firstCol, _lastCol);
180
	}
181
	
182
	@Override
183
	public boolean equals(Object other) {
184
		if (other instanceof CellRangeAddressBase) {
185
			CellRangeAddressBase o = (CellRangeAddressBase) other;
186
			return ((getMinRow() == o.getMinRow()) &&
187
					(getMaxRow() == o.getMaxRow()) &&
188
					(getMinColumn() == o.getMinColumn()) &&
189
					(getMaxColumn() == o.getMaxColumn()));
190
		}
191
		return false;
192
	}
193
	
194
	@Override
195
	public int hashCode() {
196
		final int[] values = new int[]{getMinRow(), getMaxRow(), getMinColumn(), getMaxColumn()};
197
		return values.hashCode();
198
	}
167
}
199
}

Return to bug 58441