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: 2009.11.18 at 06:28:36 AM UTC 
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.XmlType;
018    
019    
020    /**
021     * List of arguments.
022     * @see Argument
023     * 
024     * 
025     * 
026     */
027    @XmlAccessorType(XmlAccessType.FIELD)
028    @XmlType(name = "Arguments", propOrder = {
029        "argument"
030    })
031    @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
032    public class Arguments
033        extends ModelObject
034        implements Cloneable
035    {
036    
037        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
038        protected List<Argument> argument;
039    
040        /**
041         * Creates a new {@code Arguments} instance.
042         * 
043         */
044        public Arguments() {
045            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
046            super();
047        }
048    
049        /**
050         * Creates a new {@code Arguments} instance by deeply copying a given {@code Arguments} instance.
051         * 
052         * 
053         * @param o
054         *     The instance to copy.
055         * @throws NullPointerException
056         *     if {@code o} is {@code null}.
057         */
058        public Arguments(final Arguments o) {
059            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
060            super(o);
061            if (o == null) {
062                throw new NullPointerException("Cannot create a copy of 'Arguments' from 'null'.");
063            }
064            // 'Argument' collection.
065            copyArgument(o.getArgument(), getArgument());
066        }
067    
068        /**
069         * Gets the value of the argument property.
070         * 
071         * <p>
072         * This accessor method returns a reference to the live list,
073         * not a snapshot. Therefore any modification you make to the
074         * returned list will be present inside the JAXB object.
075         * This is why there is not a <CODE>set</CODE> method for the argument property.
076         * 
077         * <p>
078         * For example, to add a new item, do as follows:
079         * <pre>
080         *    getArgument().add(newItem);
081         * </pre>
082         * 
083         * 
084         * <p>
085         * Objects of the following type(s) are allowed in the list
086         * {@link Argument }
087         * 
088         * 
089         */
090        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
091        public List<Argument> getArgument() {
092            if (argument == null) {
093                argument = new ArrayList<Argument>();
094            }
095            return this.argument;
096        }
097    
098        /**
099         * Copies all values of property {@code Argument} deeply.
100         * 
101         * @param target
102         *     The target to copy {@code source} to.
103         * @param source
104         *     The source to copy from.
105         * @throws NullPointerException
106         *     if {@code source} or {@code target} is {@code null}.
107         */
108        @SuppressWarnings("unchecked")
109        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
110        private static void copyArgument(final List<Argument> source, final List<Argument> target) {
111            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
112            if (!source.isEmpty()) {
113                for (Iterator it = source.iterator(); it.hasNext(); ) {
114                    final Object next = it.next();
115                    if (next instanceof Argument) {
116                        // CClassInfo: org.jomc.model.Argument
117                        target.add(((Argument) next).clone());
118                        continue;
119                    }
120                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
121                    throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Argument' of class 'org.jomc.model.Arguments'."));
122                }
123            }
124        }
125    
126        /**
127         * Creates and returns a deep copy of this object.
128         * 
129         * 
130         * @return
131         *     A deep copy of this object.
132         */
133        @Override
134        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
135        public Arguments clone() {
136            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
137            return new Arguments(this);
138        }
139        
140        /**
141         * Gets an argument for a given name from the list of arguments.
142         *
143         * @param name The name of the argument to return.
144         *
145         * @return The argument with name {@code name} from the list or
146         * {@code null}, if no argument matching {@code name} is found.
147         *
148         * @throws NullPointerException if {@code name} is {@code null}.
149         *
150         * @see #getArgument()
151         */
152        public Argument getArgument( final String name )
153        {
154            if ( name == null )
155            {
156                throw new NullPointerException( "name" );
157            }
158    
159            for ( Argument a : this.getArgument() )
160            {
161                if ( name.equals( a.getName() ) )
162                {
163                    return a;
164                }
165            }
166    
167            return null;
168        }
169    
170        /**
171         * Gets an argument for a given index from the list of arguments.
172         *
173         * @param index The index of the argument to return.
174         *
175         * @return The argument at {@code index} from the list.
176         *
177         * @throws IndexOutOfBoundsException if {@code index} is negative, greater
178         * or equal to the size of the list of arguments.
179         *
180         * @see #getArgument()
181         */
182        public Argument getArgument( final int index )
183        {
184            if ( index < 0 || index >= this.getArgument().size() )
185            {
186                throw new IndexOutOfBoundsException( Integer.toString( index ) );
187            }
188    
189            for ( Argument a : this.getArgument() )
190            {
191                if ( index == a.getIndex() )
192                {
193                    return a;
194                }
195            }
196    
197            return null;
198        }
199    
200          
201    }