Coverage Report - net.sourceforge.jeuclid.elements.presentation.general.Mroot
 
Classes in this File Line Coverage Branch Coverage Complexity
Mroot
12%
2/16
0%
0/2
1,25
 
 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: Mroot.java,v bc1d5fde7b73 2009/06/01 14:40:54 maxberger $ */
 18  
 
 19  
 package net.sourceforge.jeuclid.elements.presentation.general;
 20  
 
 21  
 import java.util.ArrayList;
 22  
 import java.util.List;
 23  
 
 24  
 import net.sourceforge.jeuclid.LayoutContext;
 25  
 import net.sourceforge.jeuclid.context.InlineLayoutContext;
 26  
 import net.sourceforge.jeuclid.context.RelativeScriptlevelLayoutContext;
 27  
 import net.sourceforge.jeuclid.layout.LayoutableNode;
 28  
 
 29  
 import org.apache.batik.dom.AbstractDocument;
 30  
 import org.w3c.dom.Node;
 31  
 import org.w3c.dom.mathml.MathMLElement;
 32  
 
 33  
 /**
 34  
  * This class presents a mathematical root.
 35  
  * 
 36  
  * @version $Revision: bc1d5fde7b73 $
 37  
  */
 38  
 public final class Mroot extends AbstractRoot {
 39  
 
 40  
     /**
 41  
      * The XML element from this class.
 42  
      */
 43  
     public static final String ELEMENT = "mroot";
 44  
 
 45  
     private static final long serialVersionUID = 1L;
 46  
 
 47  
     /**
 48  
      * Default constructor. Sets MathML Namespace.
 49  
      * 
 50  
      * @param qname
 51  
      *            Qualified name.
 52  
      * @param odoc
 53  
      *            Owner Document.
 54  
      */
 55  
     public Mroot(final String qname, final AbstractDocument odoc) {
 56  209
         super(qname, odoc);
 57  209
     }
 58  
 
 59  
     /** {@inheritDoc} */
 60  
     @Override
 61  
     protected Node newNode() {
 62  0
         return new Mroot(this.nodeName, this.ownerDocument);
 63  
     }
 64  
 
 65  
     /** {@inheritDoc} */
 66  
     @Override
 67  
     protected List<LayoutableNode> getContent() {
 68  0
         final List<LayoutableNode> mList = new ArrayList<LayoutableNode>(1);
 69  0
         mList.add((LayoutableNode) this.getRadicand());
 70  0
         return mList;
 71  
     }
 72  
 
 73  
     /** {@inheritDoc} */
 74  
     public MathMLElement getIndex() {
 75  0
         return this.getMathElement(1);
 76  
     }
 77  
 
 78  
     /** {@inheritDoc} */
 79  
     public MathMLElement getRadicand() {
 80  0
         return this.getMathElement(0);
 81  
     }
 82  
 
 83  
     /** {@inheritDoc} */
 84  
     public void setIndex(final MathMLElement index) {
 85  0
         this.setMathElement(1, index);
 86  0
     }
 87  
 
 88  
     /** {@inheritDoc} */
 89  
     public void setRadicand(final MathMLElement radicand) {
 90  0
         this.setMathElement(0, radicand);
 91  0
     }
 92  
 
 93  
     /** {@inheritDoc} */
 94  
     @Override
 95  
     public LayoutContext getChildLayoutContext(final int childNum,
 96  
             final LayoutContext context) {
 97  0
         final LayoutContext now = this.applyLocalAttributesToContext(context);
 98  0
         if (childNum == 0) {
 99  0
             return now;
 100  
         } else {
 101  
             // As specified in M2 3.3.3.2
 102  0
             return new RelativeScriptlevelLayoutContext(
 103  
                     new InlineLayoutContext(now), 2);
 104  
         }
 105  
     }
 106  
 
 107  
 }