Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
What Is poi-5.2.3.jar?
What Is poi-5.2.3.jar?
✍: FYIcenter.com
poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.
poi-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-5.2.3.jar Target JDK version: 9 File name: poi.jar, poi-5.2.3.jar File size: 2964641 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-5.2.3.jar:
⏎ org/apache/poi/ss/formula/FormulaUsedBlankCellSet.java
/* ====================================================================
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.ss.formula;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.poi.ss.util.CellReference;
/**
* Optimization - compacts many blank cell references used by a single formula.
*/
final class FormulaUsedBlankCellSet {
public static final class BookSheetKey {
private final int _bookIndex;
private final int _sheetIndex;
public BookSheetKey(int bookIndex, int sheetIndex) {
_bookIndex = bookIndex;
_sheetIndex = sheetIndex;
}
@Override
public int hashCode() {
return _bookIndex * 17 + _sheetIndex;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof BookSheetKey)) {
return false;
}
BookSheetKey other = (BookSheetKey) obj;
return _bookIndex == other._bookIndex && _sheetIndex == other._sheetIndex;
}
}
private static final class BlankCellSheetGroup {
private final List<BlankCellRectangleGroup> _rectangleGroups;
private int _currentRowIndex;
private int _firstColumnIndex;
private int _lastColumnIndex;
private BlankCellRectangleGroup _currentRectangleGroup;
private int _lastDefinedRow;
public BlankCellSheetGroup(int lastDefinedRow) {
_rectangleGroups = new ArrayList<>();
_currentRowIndex = -1;
_lastDefinedRow = lastDefinedRow;
}
public void addCell(int rowIndex, int columnIndex) {
if (rowIndex > _lastDefinedRow) return;
if (_currentRowIndex == -1) {
_currentRowIndex = rowIndex;
_firstColumnIndex = columnIndex;
_lastColumnIndex = columnIndex;
} else {
if (_currentRowIndex == rowIndex && _lastColumnIndex+1 == columnIndex) {
_lastColumnIndex = columnIndex;
} else {
// cell does not fit on end of current row
if (_currentRectangleGroup == null) {
_currentRectangleGroup = new BlankCellRectangleGroup(_currentRowIndex, _firstColumnIndex, _lastColumnIndex);
} else {
if (!_currentRectangleGroup.acceptRow(_currentRowIndex, _firstColumnIndex, _lastColumnIndex)) {
_rectangleGroups.add(_currentRectangleGroup);
_currentRectangleGroup = new BlankCellRectangleGroup(_currentRowIndex, _firstColumnIndex, _lastColumnIndex);
}
}
_currentRowIndex = rowIndex;
_firstColumnIndex = columnIndex;
_lastColumnIndex = columnIndex;
}
}
}
public boolean containsCell(int rowIndex, int columnIndex) {
if (rowIndex > _lastDefinedRow) return true;
for (int i=_rectangleGroups.size()-1; i>=0; i--) {
BlankCellRectangleGroup bcrg = _rectangleGroups.get(i);
if (bcrg.containsCell(rowIndex, columnIndex)) {
return true;
}
}
if(_currentRectangleGroup != null && _currentRectangleGroup.containsCell(rowIndex, columnIndex)) {
return true;
}
if (_currentRowIndex != -1 && _currentRowIndex == rowIndex) {
if (_firstColumnIndex <= columnIndex && columnIndex <= _lastColumnIndex) {
return true;
}
}
return false;
}
}
private static final class BlankCellRectangleGroup {
private final int _firstRowIndex;
private final int _firstColumnIndex;
private final int _lastColumnIndex;
private int _lastRowIndex;
public BlankCellRectangleGroup(int firstRowIndex, int firstColumnIndex, int lastColumnIndex) {
_firstRowIndex = firstRowIndex;
_firstColumnIndex = firstColumnIndex;
_lastColumnIndex = lastColumnIndex;
_lastRowIndex = firstRowIndex;
}
public boolean containsCell(int rowIndex, int columnIndex) {
if (columnIndex < _firstColumnIndex) {
return false;
}
if (columnIndex > _lastColumnIndex) {
return false;
}
if (rowIndex < _firstRowIndex) {
return false;
}
if (rowIndex > _lastRowIndex) {
return false;
}
return true;
}
public boolean acceptRow(int rowIndex, int firstColumnIndex, int lastColumnIndex) {
if (firstColumnIndex != _firstColumnIndex) {
return false;
}
if (lastColumnIndex != _lastColumnIndex) {
return false;
}
if (rowIndex != _lastRowIndex+1) {
return false;
}
_lastRowIndex = rowIndex;
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(64);
CellReference crA = new CellReference(_firstRowIndex, _firstColumnIndex, false, false);
CellReference crB = new CellReference(_lastRowIndex, _lastColumnIndex, false, false);
sb.append(getClass().getName());
sb.append(" [").append(crA.formatAsString()).append(':').append(crB.formatAsString()).append("]");
return sb.toString();
}
}
private final Map<BookSheetKey, BlankCellSheetGroup> _sheetGroupsByBookSheet;
public FormulaUsedBlankCellSet() {
_sheetGroupsByBookSheet = new HashMap<>();
}
public void addCell(EvaluationWorkbook evalWorkbook, int bookIndex, int sheetIndex, int rowIndex, int columnIndex) {
BlankCellSheetGroup sbcg = getSheetGroup(evalWorkbook, bookIndex, sheetIndex);
sbcg.addCell(rowIndex, columnIndex);
}
private BlankCellSheetGroup getSheetGroup(EvaluationWorkbook evalWorkbook, int bookIndex, int sheetIndex) {
BookSheetKey key = new BookSheetKey(bookIndex, sheetIndex);
BlankCellSheetGroup result = _sheetGroupsByBookSheet.get(key);
if (result == null) {
result = new BlankCellSheetGroup(evalWorkbook.getSheet(sheetIndex).getLastRowNum());
_sheetGroupsByBookSheet.put(key, result);
}
return result;
}
public boolean containsCell(BookSheetKey key, int rowIndex, int columnIndex) {
BlankCellSheetGroup bcsg = _sheetGroupsByBookSheet.get(key);
if (bcsg == null) {
return false;
}
return bcsg.containsCell(rowIndex, columnIndex);
}
public boolean isEmpty() {
return _sheetGroupsByBookSheet.isEmpty();
}
}
⏎ org/apache/poi/ss/formula/FormulaUsedBlankCellSet.java
Or download all of them as a single archive file:
File name: poi-5.2.3-src.zip File size: 2479830 bytes Release date: 2022-09-09 Download
⇒ What Is poi-ooxml-5.2.3.jar?
⇐ What Is poi-bin-5.2.3-20220909.zip?
2017-04-04, ≈334🔥, 0💬
Popular Posts:
Apache Log4j provides the interface that applications should code to and provides the adapter compon...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
What Is commons-lang3-3.1.jar? commons-lang3-3.1.jar is the JAR file for Apache Commons Lang 3.1, wh...
maven-model-builder-3.5. 4.jaris the JAR file for Apache Maven 3.5.4 Model Builder module. Apache Ma...