View Javadoc

1   /*
2    * Copyright 2007 - 2007 JEuclid, http://jeuclid.sf.net
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.w3c.dom.mathml;
17  
18  import org.w3c.dom.DOMException;
19  
20  /*
21   * Please note: This file was automatically generated from the source of the
22   * MathML specification. Do not edit it. If there are errors or missing
23   * elements, please correct the stylesheet instead.
24   */
25  
26  /**
27   * This interface represents the semantics element in MathML.
28   * 
29   */
30  public interface MathMLSemanticsElement extends MathMLElement {
31      /**
32       * This attribute represents the first child of the semantics element,
33       * i.e. the child giving the primary content represented by the element.
34       * 
35       * @return value of the body attribute.
36       */
37      MathMLElement getBody();
38  
39      /**
40       * setter for the body attribute.
41       * 
42       * @param body
43       *            new value for body.
44       * @see #getBody()
45       */
46      void setBody(MathMLElement body);
47  
48      /**
49       * Represents the number of annotation or annotation-xml children of the
50       * semantics element, i.e. the number of alternate content forms for this
51       * element.
52       * 
53       * @return value of the nAnnotations attribute.
54       */
55      int getNAnnotations();
56  
57      /**
58       * This method gives access to the index-th alternate content associated
59       * with a semantics element.
60       * 
61       * @param index
62       *            The one-based index of the annotation being retrieved.
63       * @return The MathMLAnnotationElement or MathMLXMLAnnotationElement
64       *         representing the index-th annotation or annotation-xml child of
65       *         the semantics element. Note that all child elements of a
66       *         semantics element other than the first are required to be of
67       *         one of these types.
68       */
69      MathMLElement getAnnotation(int index);
70  
71      /**
72       * This method inserts newAnnotation before the current index-th alternate
73       * content associated with a semantics element. If index is 0,
74       * newAnnotation is appended as the last annotation or annotation-xml
75       * child of this element.
76       * 
77       * @param newAnnotation
78       *            A MathMLAnnotationElement or MathMLXMLAnnotationElement
79       *            representing the new annotation or annotation-xml to be
80       *            inserted.
81       * @param index
82       *            The position in the list of annotation or annotation-xml
83       *            children before which newAnnotation is to be inserted. The
84       *            first annotation is numbered 1.
85       * @return The MathMLAnnotationElement or MathMLXMLAnnotationElement child
86       *         of this element that represents the new annotation in the DOM.
87       * @throws DOMException
88       *             HIERARCHY_REQUEST_ERR: Raised if newAnnotation is not a
89       *             MathMLAnnotationElement or MathMLXMLAnnotationElement.
90       *             INDEX_SIZE_ERR: Raised if index is greater than the current
91       *             number of annotation or annotation-xml children of this
92       *             semantics element.
93       */
94      MathMLElement insertAnnotation(MathMLElement newAnnotation, int index)
95              throws DOMException;
96  
97      /**
98       * This method allows setting or replacement of the index-th alternate
99       * 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 };