JSci.mathml.MathMLUnderOverElementImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsci Show documentation
Show all versions of jsci Show documentation
JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software.
It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ...
Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).
The newest version!
package JSci.mathml;
import org.w3c.dom.DOMException;
import org.w3c.dom.mathml.*;
/**
* Implements a MathML under-over element.
* @version 1.0
* @author Mark Hale
*/
public class MathMLUnderOverElementImpl extends MathMLElementImpl implements MathMLUnderOverElement {
/**
* Constructs a MathML under-over element.
*/
public MathMLUnderOverElementImpl(MathMLDocumentImpl owner, String qualifiedName) {
super(owner, qualifiedName);
}
public String getAccentunder() {
if (getLocalName().equals("mover")) {
return null;
}
return getAttribute("accentunder");
}
public void setAccentunder(String accentunder) {
setAttribute("accentunder", accentunder);
}
public String getAccent() {
if (getLocalName().equals("munder")) {
return null;
}
return getAttribute("accent");
}
public void setAccent(String accent) {
setAttribute("accent", accent);
}
public MathMLElement getBase() {
return (MathMLElement) getFirstChild();
}
public void setBase(MathMLElement base) {
replaceChild(base, getFirstChild());
}
public MathMLElement getUnderscript() {
if (getLocalName().equals("mover")) {
return null;
}
return (MathMLElement) item(1);
}
public void setUnderscript(MathMLElement underscript) throws DOMException {
if (getLocalName().equals("mover")) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Cannot set a subscript for msup");
}
replaceChild(underscript, item(1));
}
public MathMLElement getOverscript() {
if (getLocalName().equals("munder")) {
return null;
}
if (getLocalName().equals("mover")) {
return (MathMLElement) item(1);
} else {
return (MathMLElement) item(2);
}
}
public void setOverscript(MathMLElement overscript) throws DOMException {
if (getLocalName().equals("munder")) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Cannot set a superscript for msub");
}
if(getLocalName().equals("mover")) {
replaceChild(overscript, item(1));
} else {
replaceChild(overscript, item(2));
}
}
}