KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > mathml > MathMLCnElementImpl


1 package JSci.mathml;
2
3 import org.w3c.dom.mathml.*;
4
5 /**
6  * Implements a MathML numeric content element.
7  * @version 1.0
8  * @author Mark Hale
9  */

10 public class MathMLCnElementImpl extends MathMLContentTokenImpl implements MathMLCnElement {
11         /**
12          * Constructs a MathML numeric content element.
13          */

14         public MathMLCnElementImpl(MathMLDocumentImpl owner, String JavaDoc qualifiedName) {
15                 super(owner, qualifiedName);
16         }
17
18         public String JavaDoc getType() {
19                 String JavaDoc type = getAttribute("type");
20                 if(type.length() == 0)
21                         type = "real";
22                 return type;
23         }
24         public void setType(String JavaDoc type) {
25                 setAttribute("type", type);
26         }
27
28         public String JavaDoc getBase() {
29                 String JavaDoc base = getAttribute("base");
30                 if(base.length() == 0)
31                         base = "10";
32                 return base;
33         }
34         public void setBase(String JavaDoc base) {
35                 setAttribute("base", base);
36         }
37
38         public int getNargs() {
39                 final int length = getLength();
40                 int numArgs = 1;
41
42                 for (int i = 0; i < length; i++) {
43                         String JavaDoc localName = item(i).getLocalName();
44                         if (localName != null && localName.equals("sep")) {
45                                 numArgs++;
46                         }
47                 }
48                 return numArgs;
49         }
50 }
51
52
Popular Tags