View Javadoc

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: JEuclidElement.java,v 5c224b0fad38 2008/05/23 10:30:28 maxberger $ */
18  
19  package net.sourceforge.jeuclid.elements;
20  
21  import net.sourceforge.jeuclid.LayoutContext;
22  import net.sourceforge.jeuclid.elements.support.attributes.MathVariant;
23  import net.sourceforge.jeuclid.layout.LayoutableNode;
24  
25  import org.w3c.dom.mathml.MathMLElement;
26  
27  /**
28   * Interface for all MathElements within JEuclid.
29   * 
30   * @version $Revision: 5c224b0fad38 $
31   */
32  public interface JEuclidElement extends MathMLElement, JEuclidNode,
33          LayoutableNode {
34  
35      /**
36       * Sets the parent of this element.
37       * 
38       * @param parent
39       *            Parent element
40       */
41      void setFakeParent(final JEuclidElement parent);
42  
43      /**
44       * Gets index of child element.
45       * 
46       * @param element
47       *            Child element.
48       * @return Index of the element, -1 if element was not found
49       */
50      int getIndexOfMathElement(final JEuclidElement element);
51  
52      /**
53       * Gets the current mathvariant.
54       * 
55       * @return the current MathVariant
56       */
57      MathVariant getMathvariantAsVariant();
58  
59      /**
60       * Returns parent of this element.
61       * 
62       * @return Parent element.
63       */
64      JEuclidElement getParent();
65  
66      /**
67       * returns true is the child has prescripts attached to it. In this case,
68       * there should be no extra space on the left.
69       * 
70       * @param child
71       *            child to test
72       * @return true if there are attached prescripts
73       */
74      boolean hasChildPrescripts(final JEuclidElement child);
75  
76      /**
77       * returns true is the child has postscripts attached to it. In this case,
78       * there should be no extra space on the left.
79       * 
80       * @param child
81       *            child to test
82       * @param context
83       *            current layout context.
84       * @return true if there are attached postscripts
85       */
86      boolean hasChildPostscripts(final JEuclidElement child,
87              LayoutContext context);
88  
89      /**
90       * Returns the count of children for this element.
91       * 
92       * @return number of children.
93       */
94      int getMathElementCount();
95  
96  }