/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
 * Schema.
 * $Id$
 */

package com.queplix.core.modules.config.jxb;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Enumeration;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;

/**
 * Contains all links in the form
 * 
 * @version $Revision$ $Date$
 */
public class Links extends com.queplix.core.utils.jxb.JXBObject 
implements java.io.Serializable
{


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Defines link to other form
     */
    private java.util.ArrayList _linkList;


      //----------------/
     //- Constructors -/
    //----------------/

    public Links() 
     {
        super();
        _linkList = new ArrayList();
    } //-- com.queplix.core.modules.config.jxb.Links()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addLink
     * 
     * 
     * 
     * @param vLink
     */
    public void addLink(com.queplix.core.modules.config.jxb.Link vLink)
        throws java.lang.IndexOutOfBoundsException
    {
        _linkList.add(vLink);
    } //-- void addLink(com.queplix.core.modules.config.jxb.Link) 

    /**
     * Method addLink
     * 
     * 
     * 
     * @param index
     * @param vLink
     */
    public void addLink(int index, com.queplix.core.modules.config.jxb.Link vLink)
        throws java.lang.IndexOutOfBoundsException
    {
        _linkList.add(index, vLink);
    } //-- void addLink(int, com.queplix.core.modules.config.jxb.Link) 

    /**
     * Method clearLink
     * 
     */
    public void clearLink()
    {
        _linkList.clear();
    } //-- void clearLink() 

    /**
     * Method enumerateLink
     * 
     * 
     * 
     * @return Enumeration
     */
    public java.util.Enumeration enumerateLink()
    {
        return new org.exolab.castor.util.IteratorEnumeration(_linkList.iterator());
    } //-- java.util.Enumeration enumerateLink() 

    /**
     * Method getLink
     * 
     * 
     * 
     * @param index
     * @return Link
     */
    public com.queplix.core.modules.config.jxb.Link getLink(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _linkList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (com.queplix.core.modules.config.jxb.Link) _linkList.get(index);
    } //-- com.queplix.core.modules.config.jxb.Link getLink(int) 

    /**
     * Method getLink
     * 
     * 
     * 
     * @return Link
     */
    public com.queplix.core.modules.config.jxb.Link[] getLink()
    {
        int size = _linkList.size();
        com.queplix.core.modules.config.jxb.Link[] mArray = new com.queplix.core.modules.config.jxb.Link[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (com.queplix.core.modules.config.jxb.Link) _linkList.get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.config.jxb.Link[] getLink() 

    /**
     * Method getLinkCount
     * 
     * 
     * 
     * @return int
     */
    public int getLinkCount()
    {
        return _linkList.size();
    } //-- int getLinkCount() 

    /**
     * Method isValid
     * 
     * 
     * 
     * @return boolean
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method marshal
     * 
     * 
     * 
     * @param out
     */
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * Method marshal
     * 
     * 
     * 
     * @param handler
     */
    public void marshal(org.xml.sax.ContentHandler handler)
        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     * Method removeLink
     * 
     * 
     * 
     * @param vLink
     * @return boolean
     */
    public boolean removeLink(com.queplix.core.modules.config.jxb.Link vLink)
    {
        boolean removed = _linkList.remove(vLink);
        return removed;
    } //-- boolean removeLink(com.queplix.core.modules.config.jxb.Link) 

    /**
     * Method setLink
     * 
     * 
     * 
     * @param index
     * @param vLink
     */
    public void setLink(int index, com.queplix.core.modules.config.jxb.Link vLink)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _linkList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _linkList.set(index, vLink);
    } //-- void setLink(int, com.queplix.core.modules.config.jxb.Link) 

    /**
     * Method setLink
     * 
     * 
     * 
     * @param linkArray
     */
    public void setLink(com.queplix.core.modules.config.jxb.Link[] linkArray)
    {
        //-- copy array
        _linkList.clear();
        for (int i = 0; i < linkArray.length; i++) {
            _linkList.add(linkArray[i]);
        }
    } //-- void setLink(com.queplix.core.modules.config.jxb.Link) 

    /**
     * Method unmarshal
     * 
     * 
     * 
     * @param reader
     * @return Object
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (com.queplix.core.modules.config.jxb.Links) Unmarshaller.unmarshal(com.queplix.core.modules.config.jxb.Links.class, reader);
    } //-- java.lang.Object unmarshal(java.io.Reader) 

    /**
     * Method validate
     * 
     */
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
