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   * The piecewise element represents the piecewise definition of a function. It
28   * contains child piece elements, each represented by a MathMLCaseElement,
29   * giving the various conditions and associated function value specifications
30   * in the function definition, and an optional otherwise child element,
31   * represented by a MathMLContentElement, giving the default value of the
32   * function - that is, the value to be assigned when none of the conditions
33   * specified in the piece child elements hold.
34   * 
35   */
36  public interface MathMLPiecewiseElement extends MathMLContentElement {
37      /**
38       * A MathMLNodeList containing one MathMLCaseElement representing each of
39       * the piece element children of this MathMLPiecewiseElement. The
40       * otherwise child (if present) is not contained in this MathMLNodeList.
41       * 
42       * @return value of the pieces attribute.
43       */
44      MathMLNodeList getPieces();
45  
46      /**
47       * Returns a MathMLContentElement representing the value to be taken by
48       * the piecewise function when none of the conditions described in the
49       * piece children is true.
50       * 
51       * @return value of the otherwise attribute.
52       */
53      MathMLContentElement getOtherwise();
54  
55      /**
56       * setter for the otherwise attribute.
57       * 
58       * @param otherwise
59       *            new value for otherwise.
60       * @see #getOtherwise()
61       */
62      void setOtherwise(MathMLContentElement otherwise);
63  
64      /**
65       * A convenience method to retrieve the child piece at the position
66       * referenced by index.
67       * 
68       * @param index
69       *            Position of desired case in the list of cases. The first
70       *            piece is numbered 1; the otherwise child (if present) is not
71       *            counted, regardless of its position. If index is greater
72       *            than the number of pieces, a null MathMLCaseElement is
73       *            returned; no error is generated.
74       * @return The MathMLCaseElement retrieved.
75       */
76      MathMLCaseElement getCase(int index);
77  
78      /**
79       * A convenience method to set the value of the child piece at the
80       * position referenced by index to the value of case.
81       * 
82       * @param index
83       *            Position of the piece to be set to case. The first piece is
84       *            numbered 1; the otherwise child (if present) is not counted,
85       *            regardless of its position. If there is currently a piece at
86       *            this position, it will be replaced by case. If index is one
87       *            more than the number of piece child elements, a new one will
88       *            be appended.
89       * @param case
90       *            A MathMLCaseElement representing the new value of the
91       *            indexth piece child.
92       * @return The new MathMLCaseElement created.
93       * @throws DOMException
94       *             INDEX_SIZE_ERR: Raised if index is greater than one more
95       *             than the number of pieces in this element.
96       */
97      MathMLCaseElement setCase(int index, MathMLCaseElement caseElement)
98              throws DOMException;
99  
100     /**
101      * A convenience method to delete the child piece at the position
102      * referenced by index. The deletion changes the indices of the following
103      * pieces.
104      * 
105      * @param index
106      *            Position of the piece to be deleted. The first piece is
107      *            numbered 1; the otherwise child (if present) is not counted,
108      *            regardless of its position.
109      * @throws DOMException
110      *             INDEX_SIZE_ERR: Raised if index is greater than the number
111      *             of pieces in this element.
112      */
113     void deleteCase(int index) throws DOMException;
114 
115     /**
116      * A convenience method to remove the child piece at the position
117      * referenced by index and return it to the caller. The removal changes
118      * the indices of the following pieces.
119      * 
120      * @param index
121      *            Position of the piece to be removed. The first piece is
122      *            numbered 1; the otherwise child (if present) is not counted,
123      *            regardless of its position.
124      * @return The MathMLCaseElement removed.
125      * @throws DOMException
126      *             INDEX_SIZE_ERR: Raised if index is greater than the number
127      *             of pieces in this element.
128      */
129     MathMLCaseElement removeCase(int index) throws DOMException;
130 
131     /**
132      * A convenience method to insert a new piece child into this element.
133      * 
134      * @param index
135      *            Position before which case is to be inserted. If index is 0,
136      *            newCase is appended as the last piece child of this element.
137      *            The otherwise child (if present) is not counted, regardless
138      *            of its position.
139      * @param newCase
140      *            A MathMLCaseElement representing the piece to be inserted.
141      * @return The new MathMLCaseElement inserted. This is the actual Element
142      *         in the DOM.
143      * @throws DOMException
144      *             INDEX_SIZE_ERR: Raised if index is greater one more than
145      *             the number of pieces in this element.
146      */
147     MathMLCaseElement insertCase(int index, MathMLCaseElement newCase)
148             throws DOMException;
149 
150     /**
151      * A convenience method to retrieve the child of the indexth piece in this
152      * element which specifies the function value for that case.
153      * 
154      * @param index
155      *            Position of the piece whose value is being requested in the
156      *            list of pieces. The first piece is numbered 1; the otherwise
157      *            child (if present) is not counted, regardless of its
158      *            position.
159      * @return The MathMLContentElement representing the value to be taken by
160      *         the function in the indexth case.
161      * @throws DOMException
162      *             INDEX_SIZE_ERR: Raised if index is greater than the number
163      *             of pieces in this element.
164      */
165     MathMLContentElement getCaseValue(int index) throws DOMException;
166 
167     /**
168      * A convenience method to set the function value for the indexth piece in
169      * this element.
170      * 
171      * @param index
172      *            Position of the piece whose value is being set in the list
173      *            of pieces. The first piece is numbered 1; the otherwise
174      *            child (if present) is not counted, regardless of its
175      *            position.
176      * @param value
177      *            A MathMLContentElement representing the function value to be
178      *            assigned in the indexth case.
179      * @return The MathMLContentElement representing the value to be taken by
180      *         the function in the indexth case.
181      * @throws DOMException
182      *             INDEX_SIZE_ERR: Raised if index is greater than the number
183      *             of pieces in this element.
184      */
185     MathMLContentElement setCaseValue(int index, MathMLContentElement value)
186             throws DOMException;
187 
188     /**
189      * A convenience method to retrieve the child of the piece at the position
190      * referenced by index which gives the condition for this case.
191      * 
192      * @param index
193      *            Position of the piece whose condition is being requested in
194      *            the list of pieces. The first piece is numbered 1; the
195      *            otherwise child (if present) is not counted, regardless of
196      *            its position.
197      * @return The MathMLContentElement representing the condition to be
198      *         satisfied for the indexth case.
199      * @throws DOMException
200      *             INDEX_SIZE_ERR: Raised if index is greater than the number
201      *             of pieces in this element.
202      */
203     MathMLContentElement getCaseCondition(int index) throws DOMException;
204 
205     /**
206      * A convenience method to set the condition for the indexth piece in this
207      * element.
208      * 
209      * @param index
210      *            Position of the piece whose condition is being set in the
211      *            list of pieces. The first piece is numbered 1; the otherwise
212      *            child (if present) is not counted, regardless of its
213      *            position.
214      * @param condition
215      *            A MathMLContentElement representing the condition to be
216      *            associated to the indexth case.
217      * @return The MathMLContentElement which is inserted as the condition
218      *         child of the indexth piece.
219      * @throws DOMException
220      *             INDEX_SIZE_ERR: Raised if index is greater than the number
221      *             of pieces in this element.
222      */
223     MathMLContentElement setCaseCondition(int index,
224             MathMLContentElement condition) throws DOMException;
225 };