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     * This interface represents the semantics element in MathML.
028     * 
029     */
030    public interface MathMLSemanticsElement extends MathMLElement {
031        /**
032         * This attribute represents the first child of the semantics element,
033         * i.e. the child giving the primary content represented by the element.
034         * 
035         * @return value of the body attribute.
036         */
037        MathMLElement getBody();
038    
039        /**
040         * setter for the body attribute.
041         * 
042         * @param body
043         *            new value for body.
044         * @see #getBody()
045         */
046        void setBody(MathMLElement body);
047    
048        /**
049         * Represents the number of annotation or annotation-xml children of the
050         * semantics element, i.e. the number of alternate content forms for this
051         * element.
052         * 
053         * @return value of the nAnnotations attribute.
054         */
055        int getNAnnotations();
056    
057        /**
058         * This method gives access to the index-th alternate content associated
059         * with a semantics element.
060         * 
061         * @param index
062         *            The one-based index of the annotation being retrieved.
063         * @return The MathMLAnnotationElement or MathMLXMLAnnotationElement
064         *         representing the index-th annotation or annotation-xml child of
065         *         the semantics element. Note that all child elements of a
066         *         semantics element other than the first are required to be of
067         *         one of these types.
068         */
069        MathMLElement getAnnotation(int index);
070    
071        /**
072         * This method inserts newAnnotation before the current index-th alternate
073         * content associated with a semantics element. If index is 0,
074         * newAnnotation is appended as the last annotation or annotation-xml
075         * child of this element.
076         * 
077         * @param newAnnotation
078         *            A MathMLAnnotationElement or MathMLXMLAnnotationElement
079         *            representing the new annotation or annotation-xml to be
080         *            inserted.
081         * @param index
082         *            The position in the list of annotation or annotation-xml
083         *            children before which newAnnotation is to be inserted. The
084         *            first annotation is numbered 1.
085         * @return The MathMLAnnotationElement or MathMLXMLAnnotationElement child
086         *         of this element that represents the new annotation in the DOM.
087         * @throws DOMException
088         *             HIERARCHY_REQUEST_ERR: Raised if newAnnotation is not a
089         *             MathMLAnnotationElement or MathMLXMLAnnotationElement.
090         *             INDEX_SIZE_ERR: Raised if index is greater than the current
091         *             number of annotation or annotation-xml children of this
092         *             semantics element.
093         */
094        MathMLElement insertAnnotation(MathMLElement newAnnotation, int index)
095                throws DOMException;
096    
097        /**
098         * This method allows setting or replacement of the index-th alternate
099         * content associated with a semantics element. If there is already an
100         * annotation or annotation-xml element with this index, it is replaced by
101         * newAnnotation.
102         * 
103         * @param newAnnotation
104         *            A MathMLAnnotationElement or MathMLXMLAnnotationElement
105         *            representing the new value of the index-th annotation or
106         *            annotation-xml child of this semantics element.
107         * @param index
108         *            The position in the list of annotation or annotation-xml
109         *            children of this semantics element that is to be occupied by
110         *            newAnnotation. The first annotation element is numbered 1.
111         * @return The MathMLAnnotationElement or MathMLXMLAnnotationElement child
112         *         of this element that represents the new annotation in the DOM.
113         * @throws DOMException
114         *             HIERARCHY_REQUEST_ERR: Raised if newAnnotation is not a
115         *             MathMLAnnotationElement or MathMLXMLAnnotationElement.
116         *             INDEX_SIZE_ERR: Raised if index is greater than one more
117         *             than the current number of annotation or annotation-xml
118         *             children of this semantics element.
119         */
120        MathMLElement setAnnotation(MathMLElement newAnnotation, int index)
121                throws DOMException;
122    
123        /**
124         * A convenience method to delete the index-th alternate content
125         * associated with this semantics element.
126         * 
127         * @param index
128         *            The one-based index of the annotation being deleted.
129         */
130        void deleteAnnotation(int index);
131    
132        /**
133         * A convenience method to delete the index-th alternate content
134         * associated with this semantics element, and to return it to the caller.
135         * 
136         * @param index
137         *            The one-based index of the annotation being deleted.
138         * @return The MathMLAnnotationElement or MathMLXMLAnnotationElement being
139         *         deleted.
140         */
141        MathMLElement removeAnnotation(int index);
142    };