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     * The piecewise element represents the piecewise definition of a function. It
028     * contains child piece elements, each represented by a MathMLCaseElement,
029     * giving the various conditions and associated function value specifications
030     * in the function definition, and an optional otherwise child element,
031     * represented by a MathMLContentElement, giving the default value of the
032     * function - that is, the value to be assigned when none of the conditions
033     * specified in the piece child elements hold.
034     * 
035     */
036    public interface MathMLPiecewiseElement extends MathMLContentElement {
037        /**
038         * A MathMLNodeList containing one MathMLCaseElement representing each of
039         * the piece element children of this MathMLPiecewiseElement. The
040         * otherwise child (if present) is not contained in this MathMLNodeList.
041         * 
042         * @return value of the pieces attribute.
043         */
044        MathMLNodeList getPieces();
045    
046        /**
047         * Returns a MathMLContentElement representing the value to be taken by
048         * the piecewise function when none of the conditions described in the
049         * piece children is true.
050         * 
051         * @return value of the otherwise attribute.
052         */
053        MathMLContentElement getOtherwise();
054    
055        /**
056         * setter for the otherwise attribute.
057         * 
058         * @param otherwise
059         *            new value for otherwise.
060         * @see #getOtherwise()
061         */
062        void setOtherwise(MathMLContentElement otherwise);
063    
064        /**
065         * A convenience method to retrieve the child piece at the position
066         * referenced by index.
067         * 
068         * @param index
069         *            Position of desired case in the list of cases. The first
070         *            piece is numbered 1; the otherwise child (if present) is not
071         *            counted, regardless of its position. If index is greater
072         *            than the number of pieces, a null MathMLCaseElement is
073         *            returned; no error is generated.
074         * @return The MathMLCaseElement retrieved.
075         */
076        MathMLCaseElement getCase(int index);
077    
078        /**
079         * A convenience method to set the value of the child piece at the
080         * position referenced by index to the value of case.
081         * 
082         * @param index
083         *            Position of the piece to be set to case. The first piece is
084         *            numbered 1; the otherwise child (if present) is not counted,
085         *            regardless of its position. If there is currently a piece at
086         *            this position, it will be replaced by case. If index is one
087         *            more than the number of piece child elements, a new one will
088         *            be appended.
089         * @param case
090         *            A MathMLCaseElement representing the new value of the
091         *            indexth piece child.
092         * @return The new MathMLCaseElement created.
093         * @throws DOMException
094         *             INDEX_SIZE_ERR: Raised if index is greater than one more
095         *             than the number of pieces in this element.
096         */
097        MathMLCaseElement setCase(int index, MathMLCaseElement caseElement)
098                throws DOMException;
099    
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    };