001    //
002    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 
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: 2012.03.28 at 01:26:51 AM CEST 
006    //
007    
008    
009    package org.jomc.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 arguments.
023     * 
024     * <p>Java class for Arguments complex type.
025     * 
026     * <p>The following schema fragment specifies the expected content contained within this class.
027     * 
028     * <pre>
029     * &lt;complexType name="Arguments">
030     *   &lt;complexContent>
031     *     &lt;extension base="{http://jomc.org/model}ModelObject">
032     *       &lt;sequence>
033     *         &lt;element ref="{http://jomc.org/model}argument" maxOccurs="unbounded" minOccurs="0"/>
034     *       &lt;/sequence>
035     *     &lt;/extension>
036     *   &lt;/complexContent>
037     * &lt;/complexType>
038     * </pre>
039     * 
040     * 
041     */
042    @XmlAccessorType(XmlAccessType.FIELD)
043    @XmlType(name = "Arguments", namespace = "http://jomc.org/model", propOrder = {
044        "argument"
045    })
046    @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
047    public class Arguments
048        extends ModelObject
049        implements Cloneable
050    {
051    
052        @XmlElement(namespace = "http://jomc.org/model")
053        @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
054        protected List<Argument> argument;
055    
056        /**
057         * Creates a new {@code Arguments} instance.
058         * 
059         */
060        public Arguments() {
061            // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
062            super();
063        }
064    
065        /**
066         * Creates a new {@code Arguments} instance by deeply copying a given {@code Arguments} instance.
067         * 
068         * 
069         * @param o
070         *     The instance to copy.
071         * @throws NullPointerException
072         *     if {@code o} is {@code null}.
073         */
074        public Arguments(final Arguments o) {
075            // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
076            super(o);
077            if (o == null) {
078                throw new NullPointerException("Cannot create a copy of 'Arguments' from 'null'.");
079            }
080            // 'Argument' collection.
081            if (o.argument!= null) {
082                copyArgument(o.getArgument(), this.getArgument());
083            }
084        }
085    
086        /**
087         * Gets the value of the argument property.
088         * 
089         * <p>
090         * This accessor method returns a reference to the live list,
091         * not a snapshot. Therefore any modification you make to the
092         * returned list will be present inside the JAXB object.
093         * This is why there is not a <CODE>set</CODE> method for the argument property.
094         * 
095         * <p>
096         * For example, to add a new item, do as follows:
097         * <pre>
098         *    getArgument().add(newItem);
099         * </pre>
100         * 
101         * 
102         * <p>
103         * Objects of the following type(s) are allowed in the list
104         * {@link Argument }
105         * 
106         * 
107         */
108        @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
109        public List<Argument> getArgument() {
110            if (argument == null) {
111                argument = new ArrayList<Argument>();
112            }
113            return this.argument;
114        }
115    
116        /**
117         * Copies all values of property {@code Argument} 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 = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
128        private static void copyArgument(final List<Argument> source, final List<Argument> target) {
129            // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 Argument) {
134                        // CClassInfo: org.jomc.model.Argument
135                        target.add(((Argument) 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 'Argument' of class 'org.jomc.model.Arguments'."));
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 = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
153        public Arguments clone() {
154            {
155                // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
156                final Arguments clone = ((Arguments) super.clone());
157                // 'Argument' collection.
158                if (this.argument!= null) {
159                    clone.argument = null;
160                    copyArgument(this.getArgument(), clone.getArgument());
161                }
162                return clone;
163            }
164        }
165        
166        /**
167         * Gets an argument for a given name from the list of arguments.
168         *
169         * @param name The name of the argument to return.
170         *
171         * @return The first matching argument or {@code null}, if no such argument is found.
172         *
173         * @throws NullPointerException if {@code name} is {@code null}.
174         *
175         * @see #getArgument()
176         * @see Argument#getName()
177         */
178        public Argument getArgument( final String name )
179        {
180            if ( name == null )
181            {
182                throw new NullPointerException( "name" );
183            }
184    
185            for ( int i = 0, s0 = this.getArgument().size(); i < s0; i++ )
186            {
187                final Argument a = this.getArgument().get( i );
188    
189                if ( name.equals( a.getName() ) )
190                {
191                    return a;
192                }
193            }
194    
195            return null;
196        }
197    
198        /**
199         * Gets an argument for a given index from the list of arguments.
200         *
201         * @param index The index of the argument to return.
202         *
203         * @return The first matching argument or {@code null}, if no such argument is found.
204         *
205         * @throws IndexOutOfBoundsException if {@code index} is negative, greater or equal to the size of the list of
206         * arguments.
207         *
208         * @see #getArgument()
209         * @see Argument#getIndex()
210         */
211        public Argument getArgument( final int index )
212        {
213            if ( index < 0 || index >= this.getArgument().size() )
214            {
215                throw new IndexOutOfBoundsException( Integer.toString( index ) );
216            }
217    
218            for ( int i = 0, s0 = this.getArgument().size(); i < s0; i++ )
219            {
220                final Argument a = this.getArgument().get( i );
221    
222                if ( index == a.getIndex() )
223                {
224                    return a;
225                }
226            }
227    
228            return null;
229        }
230          
231    }