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