1 16 package org.outerj.daisy.books.publisher.impl.bookmodel; 17 18 import org.outerx.daisy.x10Bookdef.SectionContainerXml; 19 import org.outerx.daisy.x10Bookdef.SectionDocument; 20 21 import java.util.List ; 22 import java.util.ArrayList ; 23 24 public class SectionContainerHelper implements SectionContainer { 25 private List sections; 26 27 public Section[] getSections() { 28 if (sections == null) 29 return new Section[0]; 30 else 31 return (Section[])sections.toArray(new Section[sections.size()]); 32 } 33 34 public void addSection(Section section) { 35 if (sections == null) 36 sections = new ArrayList (); 37 sections.add(section); 38 } 39 40 public void addXml(SectionContainerXml sectionContainerXml) { 41 if (sections == null) 42 return; 43 44 Section[] sections = getSections(); 45 SectionDocument.Section[] sectionsXml = new SectionDocument.Section[sections.length]; 46 for (int i = 0; i < sections.length; i++) { 47 sectionsXml[i] = sections[i].getXml(); 48 } 49 sectionContainerXml.setSectionArray(sectionsXml); 50 } 51 52 } 53 | Popular Tags |