Coverage Report - net.sourceforge.jeuclid.elements.presentation.general.Msqrt
 
Classes in this File Line Coverage Branch Coverage Complexity
Msqrt
11%
2/17
0%
0/6
1,429
 
 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: Msqrt.java,v bc1d5fde7b73 2009/06/01 14:40:54 maxberger $ */
 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  
  * This class presents a mathematical square root.
 32  
  * 
 33  
  * @version $Revision: bc1d5fde7b73 $
 34  
  */
 35  
 public final class Msqrt extends AbstractRoot {
 36  
 
 37  
     /**
 38  
      * The XML element from this class.
 39  
      */
 40  
     public static final String ELEMENT = "msqrt";
 41  
 
 42  
     private static final long serialVersionUID = 1L;
 43  
 
 44  
     /**
 45  
      * Default constructor. Sets MathML Namespace.
 46  
      * 
 47  
      * @param qname
 48  
      *            Qualified name.
 49  
      * @param odoc
 50  
      *            Owner Document.
 51  
      */
 52  
     public Msqrt(final String qname, final AbstractDocument odoc) {
 53  209
         super(qname, odoc);
 54  209
     }
 55  
 
 56  
     /** {@inheritDoc} */
 57  
     @Override
 58  
     protected Node newNode() {
 59  0
         return new Msqrt(this.nodeName, this.ownerDocument);
 60  
     }
 61  
 
 62  
     /** {@inheritDoc} */
 63  
     @Override
 64  
     protected List<LayoutableNode> getContent() {
 65  0
         return this.getChildrenToLayout();
 66  
     }
 67  
 
 68  
     /** {@inheritDoc} */
 69  
     public MathMLElement getIndex() {
 70  0
         return null;
 71  
     }
 72  
 
 73  
     /** {@inheritDoc} */
 74  
     public MathMLElement getRadicand() {
 75  
         JEuclidElement retVal;
 76  0
         if (this.getMathElementCount() == 1) {
 77  0
             retVal = this.getMathElement(0);
 78  
         } else {
 79  0
             retVal = new Mrow(Mrow.ELEMENT, this.ownerDocument);
 80  0
             retVal.setFakeParent(this);
 81  0
             for (int i = 0; i < this.getMathElementCount(); i++) {
 82  0
                 retVal.appendChild(this.getMathElement(i));
 83  
             }
 84  
         }
 85  0
         return retVal;
 86  
     }
 87  
 
 88  
     /** {@inheritDoc} */
 89  
     public void setIndex(final MathMLElement index) {
 90  
         // Do nothing. There is no index for sqrt elements.
 91  0
     }
 92  
 
 93  
     /** {@inheritDoc} */
 94  
     public void setRadicand(final MathMLElement radicand) {
 95  0
         while (this.getMathElementCount() > 0) {
 96  0
             this.removeChild(this.getMathElement(0));
 97  
         }
 98  0
         this.setMathElement(0, radicand);
 99  0
     }
 100  
 }