001    /*
002     * Copyright 2007 - 2007 JEuclid, http://jeuclid.sf.net
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.w3c.dom.mathml;
017    
018    import org.w3c.dom.DOMException;
019    
020    /*
021     * Please note: This file was automatically generated from the source of the
022     * MathML specification. Do not edit it. If there are errors or missing
023     * elements, please correct the stylesheet instead.
024     */
025    
026    /**
027     * vector is the container element for a vector.
028     * 
029     * 
030     */
031    public interface MathMLVectorElement extends MathMLContentElement {
032        /**
033         * The number of components in the vector.
034         * 
035         * @return value of the ncomponents attribute.
036         */
037        int getNcomponents();
038    
039        /**
040         * A convenience method to retrieve a component.
041         * 
042         * @param index
043         *            Position of the component in the list of components. The
044         *            first element is numbered 1.
045         * @return The MathMLContentElement component at the position specified by
046         *         index. If index is not a valid index (i.e. is greater than the
047         *         number of components of the vector or less than 1), a null
048         *         MathMLContentElement is returned.
049         */
050        MathMLContentElement getComponent(int index);
051    
052        /**
053         * A convenience method to insert a new component in the vector before the
054         * current index-th component. If index is 0 or is one more than the
055         * number of components currently in the vector, newComponent is appended
056         * as the last component of the vector.
057         * 
058         * @param newComponent
059         *            A MathMLContentElement representing the component that is to
060         *            be added.
061         * @param index
062         *            Position of the component in the list of components. The
063         *            first component is numbered 1.
064         * @return The MathMLContentElement child of this MathMLVectorElement
065         *         representing the new component in the DOM.
066         * @throws DOMException
067         *             INDEX_SIZE_ERR: Raised if index is greater than one more
068         *             than the current number of components of this vector
069         *             element.
070         */
071        MathMLContentElement insertComponent(MathMLContentElement newComponent,
072                int index) throws DOMException;
073    
074        /**
075         * A convenience method to set the index-th component of the vector to
076         * newComponent. If index is one more than the current number of
077         * components, newComponent is appended as the last component.
078         * 
079         * @param newComponent
080         *            A MathMLContentElement representing the element that is to
081         *            be the index-th component of the vector.
082         * @param index
083         *            Position of the component in the list of components. The
084         *            first element is numbered 1.
085         * @return The MathMLContentElement child of this MathMLVectorElement that
086         *         represents the new component in the DOM.
087         * @throws DOMException
088         *             INDEX_SIZE_ERR: Raised if index is greater than one more
089         *             than the current number of components of this vector
090         *             element.
091         */
092        MathMLContentElement setComponent(MathMLContentElement newComponent,
093                int index) throws DOMException;
094    
095        /**
096         * A convenience method to delete an element. The deletion changes the
097         * indices of the following components.
098         * 
099         * @param index
100         *            Position of the component in the vector. The position of the
101         *            first component is 1
102         * @return None
103         * @throws DOMException
104         *             INDEX_SIZE_ERR: Raised if index is greater than the current
105         *             number of components of this vector element.
106         */
107        void deleteComponent(int index) throws DOMException;
108    
109        /**
110         * A convenience method to remove a component from a vector and return it
111         * to the caller. If index is greater than the number of components or is
112         * 0, a null MathMLContentElement is returned.
113         * 
114         * @param index
115         *            Position of the component in the list of components. The
116         *            first element is numbered 1.
117         * @return The MathMLContentElement component being removed.
118         */
119        MathMLContentElement removeComponent(int index);
120    };