1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.jeuclid.elements.presentation.general;
20
21 import java.util.List;
22
23 import net.sourceforge.jeuclid.elements.JEuclidElement;
24 import net.sourceforge.jeuclid.layout.LayoutableNode;
25
26 import org.apache.batik.dom.AbstractDocument;
27 import org.w3c.dom.Node;
28 import org.w3c.dom.mathml.MathMLElement;
29
30
31
32
33
34
35 public final class Msqrt extends AbstractRoot {
36
37
38
39
40 public static final String ELEMENT = "msqrt";
41
42 private static final long serialVersionUID = 1L;
43
44
45
46
47
48
49
50
51
52 public Msqrt(final String qname, final AbstractDocument odoc) {
53 super(qname, odoc);
54 }
55
56
57 @Override
58 protected Node newNode() {
59 return new Msqrt(this.nodeName, this.ownerDocument);
60 }
61
62
63 @Override
64 protected List<LayoutableNode> getContent() {
65 return this.getChildrenToLayout();
66 }
67
68
69 public MathMLElement getIndex() {
70 return null;
71 }
72
73
74 public MathMLElement getRadicand() {
75 JEuclidElement retVal;
76 if (this.getMathElementCount() == 1) {
77 retVal = this.getMathElement(0);
78 } else {
79 retVal = new Mrow(Mrow.ELEMENT, this.ownerDocument);
80 retVal.setFakeParent(this);
81 for (int i = 0; i < this.getMathElementCount(); i++) {
82 retVal.appendChild(this.getMathElement(i));
83 }
84 }
85 return retVal;
86 }
87
88
89 public void setIndex(final MathMLElement index) {
90
91 }
92
93
94 public void setRadicand(final MathMLElement radicand) {
95 while (this.getMathElementCount() > 0) {
96 this.removeChild(this.getMathElement(0));
97 }
98 this.setMathElement(0, radicand);
99 }
100 }