| 1 | // | 
| 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2  | 
| 3 | // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>  | 
| 4 | // Any modifications to this file will be lost upon recompilation of the source schema.  | 
| 5 | // Generated on: 2013.01.03 at 05:01:35 AM CET  | 
| 6 | // | 
| 7 |   | 
| 8 |   | 
| 9 | package org.jomc.model; | 
| 10 |   | 
| 11 | import java.util.ArrayList; | 
| 12 | import java.util.Iterator; | 
| 13 | import java.util.List; | 
| 14 | import javax.annotation.Generated; | 
| 15 | import javax.xml.bind.annotation.XmlAccessType; | 
| 16 | import javax.xml.bind.annotation.XmlAccessorType; | 
| 17 | import javax.xml.bind.annotation.XmlElement; | 
| 18 | import javax.xml.bind.annotation.XmlType; | 
| 19 |   | 
| 20 |   | 
| 21 | /** | 
| 22 |  * List of dependencies. | 
| 23 |  *  | 
| 24 |  * <p>Java class for Dependencies complex type. | 
| 25 |  *  | 
| 26 |  * <p>The following schema fragment specifies the expected content contained within this class. | 
| 27 |  *  | 
| 28 |  * <pre> | 
| 29 |  * <complexType name="Dependencies"> | 
| 30 |  *   <complexContent> | 
| 31 |  *     <extension base="{http://jomc.org/model}ModelObject"> | 
| 32 |  *       <sequence> | 
| 33 |  *         <element ref="{http://jomc.org/model}dependency" maxOccurs="unbounded" minOccurs="0"/> | 
| 34 |  *       </sequence> | 
| 35 |  *     </extension> | 
| 36 |  *   </complexContent> | 
| 37 |  * </complexType> | 
| 38 |  * </pre> | 
| 39 |  *  | 
| 40 |  *  | 
| 41 |  */ | 
| 42 | @XmlAccessorType(XmlAccessType.FIELD) | 
| 43 | @XmlType(name = "Dependencies", namespace = "http://jomc.org/model", propOrder = { | 
| 44 |     "dependency" | 
| 45 | }) | 
| 46 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-03T05:01:35+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") | 
| 47 | public class Dependencies | 
| 48 |     extends ModelObject | 
| 49 |     implements Cloneable | 
| 50 | { | 
| 51 |   | 
| 52 |     @XmlElement(namespace = "http://jomc.org/model") | 
| 53 |     @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-03T05:01:35+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") | 
| 54 |     protected List<Dependency> dependency; | 
| 55 |   | 
| 56 |     /** | 
| 57 |      * Creates a new {@code Dependencies} instance. | 
| 58 |      *  | 
| 59 |      */ | 
| 60 |     public Dependencies() { | 
| 61 |         // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 | 
| 62 |         super(); | 
| 63 |     } | 
| 64 |   | 
| 65 |     /** | 
| 66 |      * Creates a new {@code Dependencies} instance by deeply copying a given {@code Dependencies} instance. | 
| 67 |      *  | 
| 68 |      *  | 
| 69 |      * @param o | 
| 70 |      *     The instance to copy. | 
| 71 |      * @throws NullPointerException | 
| 72 |      *     if {@code o} is {@code null}. | 
| 73 |      */ | 
| 74 |     public Dependencies(final Dependencies o) { | 
| 75 |         // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 | 
| 76 |         super(o); | 
| 77 |         if (o == null) { | 
| 78 |             throw new NullPointerException("Cannot create a copy of 'Dependencies' from 'null'."); | 
| 79 |         } | 
| 80 |         // 'Dependency' collection. | 
| 81 |         if (o.dependency!= null) { | 
| 82 |             copyDependency(o.getDependency(), this.getDependency()); | 
| 83 |         } | 
| 84 |     } | 
| 85 |   | 
| 86 |     /** | 
| 87 |      * Gets the value of the dependency property. | 
| 88 |      *  | 
| 89 |      * <p> | 
| 90 |      * This accessor method returns a reference to the live list, | 
| 91 |      * not a snapshot. Therefore any modification you make to the | 
| 92 |      * returned list will be present inside the JAXB object. | 
| 93 |      * This is why there is not a <CODE>set</CODE> method for the dependency property. | 
| 94 |      *  | 
| 95 |      * <p> | 
| 96 |      * For example, to add a new item, do as follows: | 
| 97 |      * <pre> | 
| 98 |      *    getDependency().add(newItem); | 
| 99 |      * </pre> | 
| 100 |      *  | 
| 101 |      *  | 
| 102 |      * <p> | 
| 103 |      * Objects of the following type(s) are allowed in the list | 
| 104 |      * {@link Dependency } | 
| 105 |      *  | 
| 106 |      *  | 
| 107 |      */ | 
| 108 |     @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-03T05:01:35+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") | 
| 109 |     public List<Dependency> getDependency() { | 
| 110 |         if (dependency == null) { | 
| 111 |             dependency = new ArrayList<Dependency>(); | 
| 112 |         } | 
| 113 |         return this.dependency; | 
| 114 |     } | 
| 115 |   | 
| 116 |     /** | 
| 117 |      * Copies all values of property {@code Dependency} deeply. | 
| 118 |      *  | 
| 119 |      * @param source | 
| 120 |      *     The source to copy from. | 
| 121 |      * @param target | 
| 122 |      *     The target to copy {@code source} to. | 
| 123 |      * @throws NullPointerException | 
| 124 |      *     if {@code target} is {@code null}. | 
| 125 |      */ | 
| 126 |     @SuppressWarnings("unchecked") | 
| 127 |     @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-03T05:01:35+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") | 
| 128 |     private static void copyDependency(final List<Dependency> source, final List<Dependency> target) { | 
| 129 |         // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 | 
| 130 |         if ((source!= null)&&(!source.isEmpty())) { | 
| 131 |             for (final Iterator<?> it = source.iterator(); it.hasNext(); ) { | 
| 132 |                 final Object next = it.next(); | 
| 133 |                 if (next instanceof Dependency) { | 
| 134 |                     // CClassInfo: org.jomc.model.Dependency | 
| 135 |                     target.add(((Dependency) next).clone()); | 
| 136 |                     continue; | 
| 137 |                 } | 
| 138 |                 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ | 
| 139 |                 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Dependency' of class 'org.jomc.model.Dependencies'.")); | 
| 140 |             } | 
| 141 |         } | 
| 142 |     } | 
| 143 |   | 
| 144 |     /** | 
| 145 |      * Creates and returns a deep copy of this object. | 
| 146 |      *  | 
| 147 |      *  | 
| 148 |      * @return | 
| 149 |      *     A deep copy of this object. | 
| 150 |      */ | 
| 151 |     @Override | 
| 152 |     @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-03T05:01:35+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") | 
| 153 |     public Dependencies clone() { | 
| 154 |         { | 
| 155 |             // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 | 
| 156 |             final Dependencies clone = ((Dependencies) super.clone()); | 
| 157 |             // 'Dependency' collection. | 
| 158 |             if (this.dependency!= null) { | 
| 159 |                 clone.dependency = null; | 
| 160 |                 copyDependency(this.getDependency(), clone.getDependency()); | 
| 161 |             } | 
| 162 |             return clone; | 
| 163 |         } | 
| 164 |     } | 
| 165 |      | 
| 166 |     /** | 
| 167 |      * Gets a dependency for a given name from the list of dependencies. | 
| 168 |      * | 
| 169 |      * @param name The name of the dependency to return. | 
| 170 |      * | 
| 171 |      * @return The first matching dependency or {@code null}, if no such dependency is found. | 
| 172 |      * | 
| 173 |      * @throws NullPointerException if {@code name} is {@code null}. | 
| 174 |      * | 
| 175 |      * @see #getDependency() | 
| 176 |      * @see Dependency#getName() | 
| 177 |      */ | 
| 178 |     public Dependency getDependency( final String name ) | 
| 179 |     { | 
| 180 |         if ( name == null ) | 
| 181 |         { | 
| 182 |             throw new NullPointerException( "identifier" ); | 
| 183 |         } | 
| 184 |   | 
| 185 |         for ( int i = 0, s0 = this.getDependency().size(); i < s0; i++ ) | 
| 186 |         { | 
| 187 |             final Dependency d = this.getDependency().get( i ); | 
| 188 |   | 
| 189 |             if ( name.equals( d.getName() ) ) | 
| 190 |             { | 
| 191 |                 return d; | 
| 192 |             } | 
| 193 |         } | 
| 194 |   | 
| 195 |         return null; | 
| 196 |     } | 
| 197 |   | 
| 198 |     /** | 
| 199 |      * Gets a list of dependencies referencing a given specification. | 
| 200 |      * | 
| 201 |      * @param specification The identifier of a specification referenced by the dependencies to return. | 
| 202 |      * | 
| 203 |      * @return An unmodifiable list holding all dependencies referencing {@code specification}. | 
| 204 |      * | 
| 205 |      * @throws NullPointerException if {@code specification} is {@code null}. | 
| 206 |      * | 
| 207 |      * @see #getDependency() | 
| 208 |      * @see Dependency#getIdentifier() | 
| 209 |      * | 
| 210 |      * @since 1.2 | 
| 211 |      */ | 
| 212 |     public List<Dependency> getDependenciesBySpecification( final String specification ) | 
| 213 |     { | 
| 214 |         if ( specification == null ) | 
| 215 |         { | 
| 216 |             throw new NullPointerException( "specification" ); | 
| 217 |         } | 
| 218 |   | 
| 219 |         final List<Dependency> list = new ArrayList<Dependency>( this.getDependency().size() ); | 
| 220 |   | 
| 221 |         for ( int i = 0, s0 = this.getDependency().size(); i < s0; i++ ) | 
| 222 |         { | 
| 223 |             final Dependency d = this.getDependency().get( i ); | 
| 224 |   | 
| 225 |             if ( specification.equals( d.getIdentifier() ) ) | 
| 226 |             { | 
| 227 |                 list.add( d ); | 
| 228 |             } | 
| 229 |         } | 
| 230 |   | 
| 231 |         return java.util.Collections.unmodifiableList( list ); | 
| 232 |     } | 
| 233 |        | 
| 234 | } |