操作メソッド追加

This commit is contained in:
r-ca 2023-12-25 14:29:10 +09:00
parent 5ff6ac32ba
commit a4db519fcf
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -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);
}
}
}