2020-12-27_8tei_release_2
authorsatomichan <git.20200328@...>
Sun, 27 Dec 2020 08:11:59 +0000 (17:11 +0900)
committersatomichan <git.20200328@...>
Sun, 27 Dec 2020 08:11:59 +0000 (17:11 +0900)
src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java [deleted file]
src/main/java/jp/satomichan/nucalgen/Nucalgen.java

diff --git a/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java b/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java
deleted file mode 100644 (file)
index 1a39f2d..0000000
+++ /dev/null
@@ -1,126 +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<String> brightColoredVegetableList = new ArrayList<String>();
-
-       MoeStdFoodCompTable(String brightColoredVegetablesXmlFileName_){
-               this.brightColoredVegetablesXmlFileName = brightColoredVegetablesXmlFileName_;
-
-               try {
-                       XMLConfiguration config = new XMLConfiguration(this.brightColoredVegetablesXmlFileName);
-                       List<Object> 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 foodComposithonSheet = outputWorkbook.cloneSheet(0);
-               outputWorkbook.setSheetName(18, "成分表");
-               outputWorkbook.setSheetOrder("成分表", 0);
-               //Sheet foodComposithonSheet = outputWorkbook.createSheet("成分表");
-
-               //「成分識別子」行
-               Row idRow = foodComposithonSheet.getRow(10);
-               for(int i = 4; i <= 61; i++) {
-                       Cell idCell = idRow.getCell(i);
-                       idCell.setCellValue(idCell.toString().replaceAll(" ", ""));
-               }
-               idRow.createCell(62).setCellValue("GROUP");
-               idRow.createCell(63).setCellValue("BRIGHT_COLORED_VEGETABLE");
-
-               int compSheetRowIndex = 11;
-
-               //18 の食品群ごとの処理
-               for(int group = 1; group <= 18; group++) {
-                       Sheet thisSheet = outputWorkbook.getSheetAt(group);
-
-                       int rowCount = 0;
-                       for (Row thisRow : thisSheet) {
-                               rowCount++;
-                               if(rowCount < 12) {continue;}
-
-                               Row compRow = foodComposithonSheet.createRow(compSheetRowIndex);
-
-                               for (int cellCount = 1; cellCount <= 61; cellCount++) {
-                                       Cell thisCell = thisRow.getCell(cellCount);
-
-                                       String cellString = thisCell.toString();
-
-                                       cellString = cellString.replaceAll("\\(", "");
-                                       cellString = cellString.replaceAll("\\)", "");
-                                       cellString = cellString.replaceAll("-", "0");
-                                       cellString = cellString.replaceAll("Tr", "0");
-
-                                       //セル値・書式 コピー
-                                       //Cell compCell = foodComposithonSheet.getRow(compSheetRowIndex).getCell(cellCount);
-                                       Cell compCell = compRow.createCell(cellCount);
-                                       compCell.setCellValue(cellString);
-                                       compCell.setCellStyle(thisCell.getCellStyle());
-                                       compCell.setCellType(thisCell.getCellTypeEnum());
-
-                                       if(cellString.matches("^[\\d\\.]+$")) {
-                                               compCell.setCellValue(Double.parseDouble(cellString));
-                                               CellStyle aCellStyle = compCell.getCellStyle();
-                                               aCellStyle.setDataFormat((short) 0);
-                                               compCell.setCellStyle(aCellStyle);
-                                       }
-
-
-                               } //CELL
-
-                               //食品群(1~18)書き込み
-                               compRow.createCell(62).setCellValue(group);
-
-
-                               //緑黄色野菜か?
-                               if(brightColoredVegetablesXmlFileName.length() > 0) {
-                                       boolean isBrightColored = false;
-                                       String foodName = thisRow.getCell(3).getStringCellValue();
-                                       for(String aBright : this.brightColoredVegetableList) {
-                                               if(foodName.matches(aBright + ".*")) {
-                                                       isBrightColored = true;
-                                                       break;
-                                               }
-                                       }
-
-                                       if(isBrightColored) {
-                                               compRow.createCell(63).setCellValue(1);
-                                       }
-                               }
-
-
-                               compSheetRowIndex++;
-
-                       } //ROW
-
-               } //GROUP
-
-               //元の表 削除
-               for(int i = 18; i > 0; i--) {
-                       outputWorkbook.removeSheetAt(i);
-               }
-       }
-
-
-
-}
index b0295c44ba315ebd648db6e55332d8e09d10300f..9f900568c84cd660be73021ff7b7b5f6406c4c32 100644 (file)
@@ -55,7 +55,7 @@ public class Nucalgen {
 
                        if(cmd.hasOption("use-processed-table") == false) {
                                //成分表 変換
-                               MoeStdFoodCompTable moe = new MoeStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list"));
+                               MextStdFoodCompTable moe = new MextStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list"));
                                moe.processInto(outputWorkbook);
                        }
 
@@ -115,7 +115,7 @@ public class Nucalgen {
                        }
 
 
-                       //摂取量 名前付き範囲
+                       //摂取量 名前付き範囲
                        String intakeArea = new CellReference(calcSheet.getSheetName(), 3, 3, true, true).formatAsString() + ":" + new CellReference(calcSheet.getSheetName(), rowIndex -1, 3, true, true).formatAsString();
                        XSSFName intakeNamedRangeArea = (XSSFName) outputWorkbook.createName();
                        intakeNamedRangeArea.setNameName("AREA_INTAKE");