X-Git-Url: https://satomichan.jp/gitweb/?p=nucalgen;a=blobdiff_plain;f=nucalgen%2Fsrc%2Fmain%2Fjava%2Fjp%2Fsatomichan%2Fnucalgen%2FMoeStdFoodCompTable.java;fp=nucalgen%2Fsrc%2Fmain%2Fjava%2Fjp%2Fsatomichan%2Fnucalgen%2FMoeStdFoodCompTable.java;h=0000000000000000000000000000000000000000;hp=9799937144b3f4feb506de5e2cc00766aab2d699;hb=bcdb2cb3b4097c8bf9d661e888e0ea56b258a730;hpb=288847d89d13ec0b30a06370505c148b08ed3d55 diff --git a/nucalgen/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java b/nucalgen/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java deleted file mode 100644 index 9799937..0000000 --- a/nucalgen/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java +++ /dev/null @@ -1,91 +0,0 @@ -package jp.satomichan.nucalgen; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; - -public class MoeStdFoodCompTable { - private String brightColoredVegetablesXmlFileName = ""; - private List brightColoredVegetableList = new ArrayList(); - - MoeStdFoodCompTable(String brightColoredVegetablesXmlFileName_){ - this.brightColoredVegetablesXmlFileName = brightColoredVegetablesXmlFileName_; - - try { - XMLConfiguration config = new XMLConfiguration(this.brightColoredVegetablesXmlFileName); - List vegetableNames = config.getList("bright-colored-vegetable.name"); - for(Object vegeObj : vegetableNames) { - this.brightColoredVegetableList.add(vegeObj.toString()); - } - - } catch (ConfigurationException e) { - e.printStackTrace(); - } - } - - - - //「本表」変換 - void processInto(Workbook outputWorkbook) { - Sheet mainSheet = outputWorkbook.getSheet("本表"); - int rowCount = 0; - int lastCol = mainSheet.getRow(5).getLastCellNum(); - mainSheet.getRow(5).getCell(4).setCellValue("廃棄率"); - mainSheet.getRow(5).createCell(lastCol + 1).setCellValue("食品群"); - mainSheet.getRow(5).createCell(lastCol + 2).setCellValue("緑黄色野菜"); - - - for (Row row : mainSheet) { - rowCount++; - if(rowCount < 8) {continue;} - - for (Cell cell : row) { - String cellString = cell.toString(); - - cellString = cellString.replaceAll("\\(", ""); - cellString = cellString.replaceAll("\\)", ""); - cellString = cellString.replaceAll("-", "0"); - cellString = cellString.replaceAll("Tr", "0"); - - - if(cellString.matches("^[\\d\\.]+$")) { - cell.setCellValue(Double.parseDouble(cellString)); - CellStyle aCellStyle = cell.getCellStyle(); - aCellStyle.setDataFormat((short) 0); - cell.setCellStyle(aCellStyle); - } - - } - - int gun = (int) row.getCell(0).getNumericCellValue(); - row.createCell(lastCol + 1).setCellValue(gun); - - - //緑黄色野菜 - if(brightColoredVegetablesXmlFileName.length() > 0) { - boolean isBrightColored = false; - String foodName = row.getCell(3).getStringCellValue(); - for(String aBright : this.brightColoredVegetableList) { - if(foodName.matches(aBright + ".*")) { - isBrightColored = true; - break; - } - } - - if(isBrightColored) { - row.createCell(lastCol + 2).setCellValue(1); - } - } - - } - - - } -}