From: satomichan <...@...>
Date: Sun, 29 Nov 2020 01:27:36 +0000 (+0900)
Subject: 2020-11-29
X-Git-Tag: 1st_release_2020-11-29
X-Git-Url: https://satomichan.jp/gitweb/?a=commitdiff_plain;h=7ff28a4ac4320eee438399aeea78e6b3af7f8e13;p=nucalgen
2020-11-29
---
288847d89d13ec0b30a06370505c148b08ed3d55
diff --git a/nucalgen/pom.xml b/nucalgen/pom.xml
new file mode 100644
index 0000000..7a36375
--- /dev/null
+++ b/nucalgen/pom.xml
@@ -0,0 +1,36 @@
+
+ 4.0.0
+ eiyou_table
+ eiyou_table
+ 0.0.1-SNAPSHOT
+ EiyouTable
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.17
+
+
+
+ commons-configuration
+ commons-configuration
+ 1.4
+
+
+
+ commons-collections
+ commons-collections
+ 3.2.2
+
+
+
+ commons-cli
+ commons-cli
+ 1.4
+
+
+
+
+
\ No newline at end of file
diff --git a/nucalgen/src/main/java/jp/satomichan/nucalgen/CellStylePool.java b/nucalgen/src/main/java/jp/satomichan/nucalgen/CellStylePool.java
new file mode 100644
index 0000000..bd1be5b
--- /dev/null
+++ b/nucalgen/src/main/java/jp/satomichan/nucalgen/CellStylePool.java
@@ -0,0 +1,104 @@
+package jp.satomichan.nucalgen;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFDataFormat;
+
+public class CellStylePool {
+
+ private Workbook workbook;
+
+ CellStylePool(Workbook workbook){
+ this.workbook = workbook;
+ }
+
+
+ private Map cellStyleMap = new HashMap();
+
+
+ CellStyle getCellStyle(String format) {
+ return this.getCellStyle(format, true);
+ }
+
+
+ CellStyle getCellStyle(String format, Boolean locked) {
+ CompKey key = new CompKey(format, locked);
+ if(this.cellStyleMap.containsKey(key)) {
+ return this.cellStyleMap.get(key);
+ }else {
+ CellStyle cs = this.workbook.createCellStyle();
+ XSSFDataFormat xssfFormat = (XSSFDataFormat) this.workbook.createDataFormat();
+ cs.setDataFormat(xssfFormat.getFormat(format));
+ cs.setLocked(locked);
+ this.cellStyleMap.put(key, cs);
+
+ return this.cellStyleMap.get(key);
+ }
+ }
+
+
+ class CompKey {
+ private String format;
+ private Boolean locked;
+
+ CompKey(String format, Boolean locked){
+ this.setFormat(format);
+ this.setLocked(locked);
+ }
+
+ public String getFormat() {
+ return format;
+ }
+ public void setFormat(String format) {
+ this.format = format;
+ }
+ public Boolean getLocked() {
+ return locked;
+ }
+ public void setLocked(Boolean locked) {
+ this.locked = locked;
+ }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + getEnclosingInstance().hashCode();
+ result = prime * result + ((format == null) ? 0 : format.hashCode());
+ result = prime * result + ((locked == null) ? 0 : locked.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CompKey other = (CompKey) obj;
+ if (!getEnclosingInstance().equals(other.getEnclosingInstance()))
+ return false;
+ if (format == null) {
+ if (other.format != null)
+ return false;
+ } else if (!format.equals(other.format))
+ return false;
+ if (locked == null) {
+ if (other.locked != null)
+ return false;
+ } else if (!locked.equals(other.locked))
+ return false;
+ return true;
+ }
+ private CellStylePool getEnclosingInstance() {
+ return CellStylePool.this;
+ }
+
+
+ }
+
+
+}
diff --git a/nucalgen/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java b/nucalgen/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java
new file mode 100644
index 0000000..9799937
--- /dev/null
+++ b/nucalgen/src/main/java/jp/satomichan/nucalgen/MoeStdFoodCompTable.java
@@ -0,0 +1,91 @@
+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