001 //
002 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
003 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
004 // Any modifications to this file will be lost upon recompilation of the source schema.
005 // Generated on: 2010.06.29 at 01:09:34 AM CEST
006 //
007
008
009 package org.jomc.tools.model;
010
011 import java.util.ArrayList;
012 import java.util.Iterator;
013 import java.util.List;
014 import javax.annotation.Generated;
015 import javax.xml.bind.annotation.XmlAccessType;
016 import javax.xml.bind.annotation.XmlAccessorType;
017 import javax.xml.bind.annotation.XmlElement;
018 import javax.xml.bind.annotation.XmlType;
019
020
021 /**
022 * List of source sections.
023 *
024 * <p>Java class for SourceSectionsType complex type.
025 *
026 * <p>The following schema fragment specifies the expected content contained within this class.
027 *
028 * <pre>
029 * <complexType name="SourceSectionsType">
030 * <complexContent>
031 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
032 * <sequence>
033 * <element ref="{http://jomc.org/tools/model}source-section" maxOccurs="unbounded" minOccurs="0"/>
034 * </sequence>
035 * </restriction>
036 * </complexContent>
037 * </complexType>
038 * </pre>
039 *
040 *
041 */
042 @XmlAccessorType(XmlAccessType.FIELD)
043 @XmlType(name = "SourceSectionsType", propOrder = {
044 "sourceSection"
045 })
046 @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T01:09:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
047 public class SourceSectionsType implements Cloneable
048 {
049
050 @XmlElement(name = "source-section")
051 @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T01:09:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
052 protected List<SourceSectionType> sourceSection;
053
054 /**
055 * Creates a new {@code SourceSectionsType} instance.
056 *
057 */
058 public SourceSectionsType() {
059 // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
060 super();
061 }
062
063 /**
064 * Creates a new {@code SourceSectionsType} instance by deeply copying a given {@code SourceSectionsType} instance.
065 *
066 *
067 * @param o
068 * The instance to copy.
069 * @throws NullPointerException
070 * if {@code o} is {@code null}.
071 */
072 public SourceSectionsType(final SourceSectionsType o) {
073 // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
074 super();
075 if (o == null) {
076 throw new NullPointerException("Cannot create a copy of 'SourceSectionsType' from 'null'.");
077 }
078 // 'SourceSection' collection.
079 copySourceSection(o.getSourceSection(), getSourceSection());
080 }
081
082 /**
083 * Gets the value of the sourceSection property.
084 *
085 * <p>
086 * This accessor method returns a reference to the live list,
087 * not a snapshot. Therefore any modification you make to the
088 * returned list will be present inside the JAXB object.
089 * This is why there is not a <CODE>set</CODE> method for the sourceSection property.
090 *
091 * <p>
092 * For example, to add a new item, do as follows:
093 * <pre>
094 * getSourceSection().add(newItem);
095 * </pre>
096 *
097 *
098 * <p>
099 * Objects of the following type(s) are allowed in the list
100 * {@link SourceSectionType }
101 *
102 *
103 */
104 @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T01:09:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
105 public List<SourceSectionType> getSourceSection() {
106 if (sourceSection == null) {
107 sourceSection = new ArrayList<SourceSectionType>();
108 }
109 return this.sourceSection;
110 }
111
112 /**
113 * Copies all values of property {@code SourceSection} deeply.
114 *
115 * @param target
116 * The target to copy {@code source} to.
117 * @param source
118 * The source to copy from.
119 * @throws NullPointerException
120 * if {@code source} or {@code target} is {@code null}.
121 */
122 @SuppressWarnings("unchecked")
123 @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T01:09:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
124 private static void copySourceSection(final List<SourceSectionType> source, final List<SourceSectionType> target) {
125 // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
126 if (!source.isEmpty()) {
127 for (Iterator it = source.iterator(); it.hasNext(); ) {
128 final Object next = it.next();
129 if (next instanceof SourceSectionType) {
130 // CClassInfo: org.jomc.tools.model.SourceSectionType
131 target.add(((SourceSectionType) next).clone());
132 continue;
133 }
134 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
135 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'SourceSection' of class 'org.jomc.tools.model.SourceSectionsType'."));
136 }
137 }
138 }
139
140 /**
141 * Creates and returns a deep copy of this object.
142 *
143 *
144 * @return
145 * A deep copy of this object.
146 */
147 @Override
148 @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T01:09:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
149 public SourceSectionsType clone() {
150 // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
151 return new SourceSectionsType(this);
152 }
153
154 /**
155 * Gets a section for a given name recursively.
156 *
157 * @param name The name of the section to return.
158 *
159 * @return The section with name {@code name} from the list or {@code null} if no such section is found.
160 *
161 * @throws NullPointerException if {@code name} is {@code null}.
162 */
163 public SourceSectionType getSourceSection( final String name )
164 {
165 if ( name == null )
166 {
167 throw new NullPointerException( "name" );
168 }
169
170 return this.getSourceSection( this, name );
171 }
172
173 private SourceSectionType getSourceSection( final SourceSectionsType sourceSectionsType, final String name )
174 {
175 if ( sourceSectionsType != null )
176 {
177 for ( SourceSectionType s : sourceSectionsType.getSourceSection() )
178 {
179 if ( name.equals( s.getName() ) )
180 {
181 return s;
182 }
183
184 final SourceSectionType sourceSectionType = this.getSourceSection( s.getSourceSections(), name );
185 if ( sourceSectionType != null )
186 {
187 return sourceSectionType;
188 }
189 }
190 }
191
192 return null;
193 }
194
195 }