@Override public void clearAllCachedResultValues() { _cellCache = null; _lastDefinedRow = _xs.getLastRowNum(); }
public XSSFEvaluationSheet(XSSFSheet sheet) { _xs = sheet; _lastDefinedRow = _xs.getLastRowNum(); }
private List<Attendance> getAttendanceLists(Meeting meeting, Map<String, Person> personMap, long attendanceId, Set<Person> speakerSet) { List<Attendance> attendanceList = new ArrayList<>(currentSheet.getLastRowNum() - 1); Set<Person> requiredPersonSet = new HashSet<>(); List<RequiredAttendance> requiredAttendanceList = getRequiredAttendanceList(meeting, personMap, speakerSet, requiredPersonSet); for (RequiredAttendance requiredAttendance : requiredAttendanceList) { requiredAttendance.setId(attendanceId++); } meeting.setRequiredAttendanceList(requiredAttendanceList); attendanceList.addAll(requiredAttendanceList); List<PreferredAttendance> preferredAttendanceList = getPreferredAttendanceList(meeting, personMap, speakerSet, requiredPersonSet); for (PreferredAttendance preferredAttendance : preferredAttendanceList) { preferredAttendance.setId(attendanceId++); } meeting.setPreferredAttendanceList(preferredAttendanceList); attendanceList.addAll(preferredAttendanceList); return attendanceList; }
if(_sh.getPhysicalNumberOfRows() > 0 && rownum <= _sh.getLastRowNum() ) { throw new IllegalArgumentException( "Attempting to write a row["+rownum+"] " + "in the range [0," + _sh.getLastRowNum() + "] that is already written to disk.");
private void readSkillList() { nextSheet("Skills"); nextRow(false); readHeaderCell("Name"); List<Skill> skillList = new ArrayList<>(currentSheet.getLastRowNum() - 1); skillMap = new HashMap<>(currentSheet.getLastRowNum() - 1); long id = 0L; while (nextRow()) { Skill skill = new Skill(); skill.setId(id++); skill.setName(nextStringCell().getStringCellValue()); skillMap.put(skill.getName(), skill); skillList.add(skill); } solution.setSkillList(skillList); }
/** * Construct a XSSFRow. * * @param row the xml bean containing all cell definitions for this row. * @param sheet the parent sheet. */ protected XSSFRow(CTRow row, XSSFSheet sheet) { _row = row; _sheet = sheet; _cells = new TreeMap<>(); for (CTCell c : row.getCArray()) { XSSFCell cell = new XSSFCell(this, c); // Performance optimization for bug 57840: explicit boxing is slightly faster than auto-unboxing, though may use more memory final Integer colI = Integer.valueOf(cell.getColumnIndex()); // NOSONAR _cells.put(colI, cell); sheet.onReadCell(cell); } if (! row.isSetR()) { // Certain file format writers skip the row number // Assume no gaps, and give this the next row number int nextRowNum = sheet.getLastRowNum()+2; if (nextRowNum == 2 && sheet.getPhysicalNumberOfRows() == 0) { nextRowNum = 1; } row.setR(nextRowNum); } }
private void readPersonList() { nextSheet("Persons"); nextRow(false); readHeaderCell("Full name"); List<Person> personList = new ArrayList<>(currentSheet.getLastRowNum() - 1); long id = 0L; while (nextRow()) { Person person = new Person(); person.setId(id++); person.setFullName(nextStringCell().getStringCellValue()); if (!VALID_NAME_PATTERN.matcher(person.getFullName()).matches()) { throw new IllegalStateException( currentPosition() + ": The person name (" + person.getFullName() + ") must match to the regular expression (" + VALID_NAME_PATTERN + ")."); } personList.add(person); } solution.setPersonList(personList); }
_cellCache = new HashMap<>(_xs.getLastRowNum() * 3); for (final Row row : _xs) { final int rowNum = row.getRowNum();
readHeaderCell("Tags"); List<TalkType> talkTypeList = new ArrayList<>(); List<Timeslot> timeslotList = new ArrayList<>(currentSheet.getLastRowNum() - 1); long id = 0L; long talkTypeId = 0L;
private void readRoomList() { nextSheet("Rooms"); nextRow(); readHeaderCell("Name"); readHeaderCell("Capacity"); List<Room> roomList = new ArrayList<>(currentSheet.getLastRowNum() - 1); long id = 0L; while (nextRow()) { Room room = new Room(); room.setId(id++); room.setName(nextStringCell().getStringCellValue()); if (!VALID_NAME_PATTERN.matcher(room.getName()).matches()) { throw new IllegalStateException( currentPosition() + ": The room name (" + room.getName() + ") must match to the regular expression (" + VALID_NAME_PATTERN + ")."); } double capacityDouble = nextNumericCell().getNumericCellValue(); if (capacityDouble <= 0 || capacityDouble != Math.floor(capacityDouble)) { throw new IllegalStateException( currentPosition() + ": The room with name (" + room.getName() + ") has a capacity (" + capacityDouble + ") that isn't a strictly positive integer number."); } room.setCapacity((int) capacityDouble); roomList.add(room); } solution.setRoomList(roomList); } }
readHeaderCell("Room"); List<Meeting> meetingList = new ArrayList<>(currentSheet.getLastRowNum() - 1); List<MeetingAssignment> meetingAssignmentList = new ArrayList<>(currentSheet.getLastRowNum() - 1); List<Attendance> attendanceList = new ArrayList<>(currentSheet.getLastRowNum() - 1); long meetingId = 0L, meetingAssignmentId = 0L, attendanceId = 0L; Map<LocalDateTime, TimeGrain> timeGrainMap = solution.getTimeGrainList().stream().collect(
List<Speaker> speakerList = new ArrayList<>(currentSheet.getLastRowNum() - 1); long id = 0L; while (nextRow()) {
readHeaderCell("Tags"); readTimeslotHoursHeaders(); List<Room> roomList = new ArrayList<>(currentSheet.getLastRowNum() - 1); long id = 0L; while (nextRow()) {
/** * @param row the zero based row index to find from */ public int findEndOfRowOutlineGroup(int row) { short level = getRow(row).getCTRow().getOutlineLevel(); int currentRow; final int lastRowNum = getLastRowNum(); for (currentRow = row; currentRow < lastRowNum; currentRow++) { if (getRow(currentRow) == null || getRow(currentRow).getCTRow().getOutlineLevel() < level) { break; } } return currentRow; }
readHeaderCell(DAY_FORMATTER.format(date)); List<Employee> employeeList = new ArrayList<>(currentSheet.getLastRowNum() - 2); nameToEmployeeMap = new HashMap<>(currentSheet.getLastRowNum() - 2); long id = 0L; while (nextRow()) {
private void readAirportList() { nextSheet("Airports"); nextRow(false); readHeaderCell("Code"); readHeaderCell("Name"); readHeaderCell("Latitude"); readHeaderCell("Longitude"); List<Airport> airportList = new ArrayList<>(currentSheet.getLastRowNum() - 1); airportMap = new HashMap<>(currentSheet.getLastRowNum() - 1); long id = 0L; while (nextRow()) { Airport airport = new Airport(); airport.setId(id++); airport.setCode(nextStringCell().getStringCellValue()); airport.setName(nextStringCell().getStringCellValue()); airport.setLatitude(nextNumericCell().getNumericCellValue()); airport.setLongitude(nextNumericCell().getNumericCellValue()); airportMap.put(airport.getCode(), airport); airportList.add(airport); } solution.setAirportList(airportList); }
readHeaderCell("Employee skill requirements"); readHeaderCell("Employee assignments"); List<Flight> flightList = new ArrayList<>(currentSheet.getLastRowNum() - 1); List<FlightAssignment> flightAssignmentList = new ArrayList<>((currentSheet.getLastRowNum() - 1) * 5); long id = 0L; long flightAssignmentId = 0L;
readHeaderCell("Start"); readHeaderCell("End"); List<Day> dayList = new ArrayList<>(currentSheet.getLastRowNum() - 1); List<TimeGrain> timeGrainList = new ArrayList<>(); long dayId = 0L, timeGrainId = 0L;
String ref = new CellRangeAddress(getFirstRowNum(), getLastRowNum(), minCell, maxCell).formatAsString(); if(worksheet.isSetDimension()) { worksheet.getDimension().setRef(ref);
readHeaderCell(Integer.toString(date.getDayOfMonth())); List<RockShow> showList = new ArrayList<>(currentSheet.getLastRowNum() - 1); long id = 0L; while (nextRow()) {