diff --git a/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaModel.java b/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaModel.java index 3bbdeb4a..a4dff2e2 100644 --- a/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaModel.java +++ b/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaModel.java @@ -70,35 +70,4 @@ public class XmlMetaModel { this.pages = pages; } - // Public Methods - - public void addPage(XmlMetaPageModel page) { - this.pages.add(page); - } - - public void addPageAfterIndex(int index, XmlMetaPageModel page) { - this.pages.add(index, page); - - //Update index - this.updateIndex(); - } - - public void removePage(XmlMetaPageModel page) { - this.pages.remove(page); - } - - public void removePageAtIndex(int index) { - this.pages.remove(index); - - //Update index - this.updateIndex(); - } - - // Internal Methods - private void updateIndex() { // TODO-rca: 効率悪そう - for (int i = 0; i < this.pages.size(); i++) { - this.pages.get(i).setIndex(i); - } - } - } diff --git a/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaPageModel.java b/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaPageModel.java index 2a4d0e5a..089aab2b 100644 --- a/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaPageModel.java +++ b/model/src/main/java/one/nem/lacerta/model/document/internal/XmlMetaPageModel.java @@ -2,7 +2,6 @@ package one.nem.lacerta.model.document.internal; public class XmlMetaPageModel { - int index; String filename; // Constructor @@ -10,27 +9,18 @@ public class XmlMetaPageModel { public XmlMetaPageModel() { } - public XmlMetaPageModel(int index, String filename) { - this.index = index; + public XmlMetaPageModel(String filename) { this.filename = filename; } // Getter - public int getIndex() { - return index; - } - public String getFilename() { return filename; } // Setter - public void setIndex(int index) { - this.index = index; - } - public void setFilename(String filename) { this.filename = filename; } diff --git a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java index 1eada540..d6b15343 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java +++ b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java @@ -102,11 +102,10 @@ public class DocumentProcessorImpl implements DocumentProcessor{ XmlMetaPageModel xmlMetaPageModel = new XmlMetaPageModel(); xmlMetaPageModel.setFilename(filename); - xmlMetaPageModel.setIndex(xmlMetaModel.getPages().size() + 1); xmlMetaModel.getPages().add(xmlMetaPageModel); logger.info("addNewPageToLast", "finished"); - logger.info("addNewPageToLast", "filename: " + filename + ", index: " + xmlMetaPageModel.getIndex()); + logger.info("addNewPageToLast", "filename: " + filename); } @Override @@ -118,19 +117,6 @@ public class DocumentProcessorImpl implements DocumentProcessor{ } // TODO-rca: 効率悪いので改善する } - // Internal - // Indexを振り直す - private ArrayList reIndexPages(ArrayList pages) { - logger.debug("reIndexPages", "called"); // TODO-rca: 効率化 - ArrayList newPages = new ArrayList<>(); - for (int i = 0; i < pages.size(); i++) { - XmlMetaPageModel xmlMetaPageModel = pages.get(i); - xmlMetaPageModel.setIndex(i + 1); - newPages.add(xmlMetaPageModel); - } - return newPages; - } - @Override public void addNewPageAfterIndex(Bitmap bitmap, int index) throws Exception { logger.debug("addNewPageAfterIndex", "called"); @@ -140,9 +126,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{ XmlMetaPageModel xmlMetaPageModel = new XmlMetaPageModel(); xmlMetaPageModel.setFilename(filename); - xmlMetaPageModel.setIndex(index + 1); xmlMetaModel.getPages().add(index, xmlMetaPageModel); - xmlMetaModel.setPages(reIndexPages(xmlMetaModel.getPages())); } @Override @@ -154,9 +138,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{ XmlMetaPageModel xmlMetaPageModel = new XmlMetaPageModel(); xmlMetaPageModel.setFilename(filename); - xmlMetaPageModel.setIndex(index); xmlMetaModel.getPages().add(index - 1, xmlMetaPageModel); - xmlMetaModel.setPages(reIndexPages(xmlMetaModel.getPages())); } @Override diff --git a/utils/src/main/java/one/nem/lacerta/utils/impl/XmlMetaParserImpl.java b/utils/src/main/java/one/nem/lacerta/utils/impl/XmlMetaParserImpl.java index efc6b1b3..7874a0b9 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/impl/XmlMetaParserImpl.java +++ b/utils/src/main/java/one/nem/lacerta/utils/impl/XmlMetaParserImpl.java @@ -41,7 +41,6 @@ public class XmlMetaParserImpl implements XmlMetaParser{ for(int i = 0; i < rootElement.getElementsByTagName("pages").getLength(); i++) { Element pageElement = (Element) rootElement.getElementsByTagName("page").item(i); XmlMetaPageModel page = new XmlMetaPageModel(); - page.setIndex(Integer.parseInt(pageElement.getElementsByTagName("index").item(0).getTextContent())); page.setFilename(pageElement.getElementsByTagName("filename").item(0).getTextContent()); pages.add(page); } @@ -73,7 +72,6 @@ public class XmlMetaParserImpl implements XmlMetaParser{ Element pagesElement = document.createElement("pages"); for(XmlMetaPageModel page : meta.getPages()) { Element pageElement = document.createElement("page"); - appendElement(document, pageElement, "index", String.valueOf(page.getIndex())); appendElement(document, pageElement, "filename", page.getFilename()); pagesElement.appendChild(pageElement); }