From a4db519fcf4386d3445f4872b5e8abb3b6adae41 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 25 Dec 2023 14:29:10 +0900 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E3=83=A1=E3=82=BD=E3=83=83?= =?UTF-8?q?=E3=83=89=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/processor/model/XmlMetaModel.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/processor/src/main/java/one/nem/lacerta/processor/model/XmlMetaModel.java b/processor/src/main/java/one/nem/lacerta/processor/model/XmlMetaModel.java index 60ac1298..bd23e8a6 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/model/XmlMetaModel.java +++ b/processor/src/main/java/one/nem/lacerta/processor/model/XmlMetaModel.java @@ -71,4 +71,35 @@ 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); + } + } + }