001 /* 002 * Copyright 2002 - 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 017 /* $Id: Msup.java,v bc1d5fde7b73 2009/06/01 14:40:54 maxberger $ */ 018 019 package net.sourceforge.jeuclid.elements.presentation.script; 020 021 import net.sourceforge.jeuclid.elements.JEuclidElement; 022 023 import org.apache.batik.dom.AbstractDocument; 024 import org.w3c.dom.DOMException; 025 import org.w3c.dom.Node; 026 import org.w3c.dom.mathml.MathMLElement; 027 028 /** 029 * This class arranges an element lower to an other element. 030 * 031 * @version $Revision: bc1d5fde7b73 $ 032 */ 033 public final class Msup extends AbstractSubSuper { 034 035 /** 036 * The XML element from this class. 037 */ 038 public static final String ELEMENT = "msup"; 039 040 private static final long serialVersionUID = 1L; 041 042 /** 043 * Default constructor. Sets MathML Namespace. 044 * 045 * @param qname 046 * Qualified name. 047 * @param odoc 048 * Owner Document. 049 */ 050 public Msup(final String qname, final AbstractDocument odoc) { 051 super(qname, odoc); 052 } 053 054 /** {@inheritDoc} */ 055 @Override 056 protected Node newNode() { 057 return new Msup(this.nodeName, this.ownerDocument); 058 } 059 060 /** {@inheritDoc} */ 061 @Override 062 public JEuclidElement getBase() { 063 return this.getMathElement(0); 064 } 065 066 /** {@inheritDoc} */ 067 @Override 068 public JEuclidElement getSubscript() { 069 return null; 070 } 071 072 /** {@inheritDoc} */ 073 @Override 074 public JEuclidElement getSuperscript() { 075 return this.getMathElement(1); 076 } 077 078 /** {@inheritDoc} */ 079 public void setBase(final MathMLElement base) { 080 this.setMathElement(0, base); 081 } 082 083 /** {@inheritDoc} */ 084 public void setSubscript(final MathMLElement subscript) { 085 throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, 086 "msup does not have subscript"); 087 } 088 089 /** {@inheritDoc} */ 090 public void setSuperscript(final MathMLElement superscript) { 091 this.setMathElement(1, superscript); 092 } 093 094 }