SourceFilesType.java

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2015.05.31 at 05:43:54 PM CEST 
//


package org.jomc.tools.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jomc.model.Inheritable;


/**
 * List of source files.
 * 
 * <p>Java class for SourceFilesType complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="SourceFilesType">
 *   &lt;complexContent>
 *     &lt;extension base="{http://jomc.org/tools/model}ToolsType">
 *       &lt;sequence>
 *         &lt;element ref="{http://jomc.org/tools/model}source-file" maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *       &lt;attribute name="final" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
 *       &lt;attribute name="override" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
 *     &lt;/extension>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SourceFilesType", namespace = "http://jomc.org/tools/model", propOrder = {
    "sourceFile"
})
@Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
public class SourceFilesType
    extends ToolsType
    implements Cloneable, Inheritable
{

    @XmlElement(name = "source-file", namespace = "http://jomc.org/tools/model")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected List<SourceFileType> sourceFile;
    @XmlAttribute(name = "final")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected Boolean _final;
    @XmlAttribute(name = "override")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected Boolean override;

    /**
     * Creates a new {@code SourceFilesType} instance.
     * 
     */
    public SourceFilesType() {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        super();
    }

    /**
     * Creates a new {@code SourceFilesType} instance by deeply copying a given {@code SourceFilesType} instance.
     * 
     * 
     * @param o
     *     The instance to copy.
     * @throws NullPointerException
     *     if {@code o} is {@code null}.
     */
    public SourceFilesType(final SourceFilesType o) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        super(o);
        if (o == null) {
            throw new NullPointerException("Cannot create a copy of 'SourceFilesType' from 'null'.");
        }
        // 'SourceFile' collection.
        if (o.sourceFile!= null) {
            copySourceFile(o.getSourceFile(), this.getSourceFile());
        }
        // CBuiltinLeafInfo: java.lang.Boolean
        this._final = ((o._final == null)?null:o.isFinal());
        // CBuiltinLeafInfo: java.lang.Boolean
        this.override = ((o.override == null)?null:o.isOverride());
    }

    /**
     * Gets the value of the sourceFile property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the sourceFile property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getSourceFile().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link SourceFileType }
     * 
     * 
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public List<SourceFileType> getSourceFile() {
        if (sourceFile == null) {
            sourceFile = new ArrayList<SourceFileType>();
        }
        return this.sourceFile;
    }

    /**
     * Gets the value of the final property.
     * 
     * @return
     *     possible object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public boolean isFinal() {
        if (_final == null) {
            return false;
        } else {
            return _final;
        }
    }

    /**
     * Sets the value of the final property.
     * 
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setFinal(Boolean value) {
        this._final = value;
    }

    /**
     * Gets the value of the override property.
     * 
     * @return
     *     possible object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public boolean isOverride() {
        if (override == null) {
            return false;
        } else {
            return override;
        }
    }

    /**
     * Sets the value of the override property.
     * 
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setOverride(Boolean value) {
        this.override = value;
    }

    /**
     * Copies all values of property {@code SourceFile} deeply.
     * 
     * @param source
     *     The source to copy from.
     * @param target
     *     The target to copy {@code source} to.
     * @throws NullPointerException
     *     if {@code target} is {@code null}.
     */
    @SuppressWarnings("unchecked")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static void copySourceFile(final List<SourceFileType> source, final List<SourceFileType> target) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if ((source!= null)&&(!source.isEmpty())) {
            for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
                final Object next = it.next();
                if (next instanceof SourceFileType) {
                    // CClassInfo: org.jomc.tools.model.SourceFileType
                    target.add(((SourceFileType) next).clone());
                    continue;
                }
                // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'SourceFile' of class 'org.jomc.tools.model.SourceFilesType'."));
            }
        }
    }

    /**
     * Creates and returns a deep copy of this object.
     * 
     * 
     * @return
     *     A deep copy of this object.
     */
    @Override
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public SourceFilesType clone() {
        {
            // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
            final SourceFilesType clone = ((SourceFilesType) super.clone());
            // 'SourceFile' collection.
            if (this.sourceFile!= null) {
                clone.sourceFile = null;
                copySourceFile(this.getSourceFile(), clone.getSourceFile());
            }
            // CBuiltinLeafInfo: java.lang.Boolean
            clone._final = ((this._final == null)?null:this.isFinal());
            // CBuiltinLeafInfo: java.lang.Boolean
            clone.override = ((this.override == null)?null:this.isOverride());
            return clone;
        }
    }
    
    /**
     * Gets a source file model for a given name from the list of source file models.
     *
     * @param identifier The identifier of the source file model to return.
     *
     * @return The first matching source file model or {@code null}, if no such source file model is found.
     *
     * @throws NullPointerException if {@code identifier} is {@code null}.
     *
     * @see #getSourceFile()
     * @see SourceFileType#getIdentifier()
     */
    public SourceFileType getSourceFile( final String identifier )
    {
        if ( identifier == null )
        {
            throw new NullPointerException( "identifier" );
        }

        for ( int i = 0, s0 = this.getSourceFile().size(); i < s0; i++ )
        {
            final SourceFileType s = this.getSourceFile().get( i );

            if ( identifier.equals( s.getIdentifier() ) )
            {
                return s;
            }
        }

        return null;
    }
      
}