View Javadoc

1   /*
2    * Copyright 2002 - 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  
17  /* $Id: Msup.java 750 2008-05-18 22:22:38Z maxberger $ */
18  
19  package net.sourceforge.jeuclid.elements.presentation.script;
20  
21  import net.sourceforge.jeuclid.elements.JEuclidElement;
22  
23  import org.w3c.dom.DOMException;
24  import org.w3c.dom.Node;
25  import org.w3c.dom.mathml.MathMLElement;
26  
27  /**
28   * This class arranges an element lower to an other element.
29   * 
30   * @version $Revision: 750 $
31   */
32  public final class Msup extends AbstractSubSuper {
33  
34      /**
35       * The XML element from this class.
36       */
37      public static final String ELEMENT = "msup";
38  
39      private static final long serialVersionUID = 1L;
40  
41      /**
42       * Creates a math element.
43       */
44      public Msup() {
45          super();
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      protected Node newNode() {
51          return new Msup();
52      }
53  
54      /** {@inheritDoc} */
55      @Override
56      public JEuclidElement getBase() {
57          return this.getMathElement(0);
58      }
59  
60      /** {@inheritDoc} */
61      @Override
62      public JEuclidElement getSubscript() {
63          return null;
64      }
65  
66      /** {@inheritDoc} */
67      @Override
68      public JEuclidElement getSuperscript() {
69          return this.getMathElement(1);
70      }
71  
72      /** {@inheritDoc} */
73      public void setBase(final MathMLElement base) {
74          this.setMathElement(0, base);
75      }
76  
77      /** {@inheritDoc} */
78      public void setSubscript(final MathMLElement subscript) {
79          throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
80                  "msup does not have subscript");
81      }
82  
83      /** {@inheritDoc} */
84      public void setSuperscript(final MathMLElement superscript) {
85          this.setMathElement(1, superscript);
86      }
87  
88  }