001 /* 002 * Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 /* $Id: JEuclidElement.java,v 5c224b0fad38 2008/05/23 10:30:28 maxberger $ */ 018 019 package net.sourceforge.jeuclid.elements; 020 021 import net.sourceforge.jeuclid.LayoutContext; 022 import net.sourceforge.jeuclid.elements.support.attributes.MathVariant; 023 import net.sourceforge.jeuclid.layout.LayoutableNode; 024 025 import org.w3c.dom.mathml.MathMLElement; 026 027 /** 028 * Interface for all MathElements within JEuclid. 029 * 030 * @version $Revision: 5c224b0fad38 $ 031 */ 032 public interface JEuclidElement extends MathMLElement, JEuclidNode, 033 LayoutableNode { 034 035 /** 036 * Sets the parent of this element. 037 * 038 * @param parent 039 * Parent element 040 */ 041 void setFakeParent(final JEuclidElement parent); 042 043 /** 044 * Gets index of child element. 045 * 046 * @param element 047 * Child element. 048 * @return Index of the element, -1 if element was not found 049 */ 050 int getIndexOfMathElement(final JEuclidElement element); 051 052 /** 053 * Gets the current mathvariant. 054 * 055 * @return the current MathVariant 056 */ 057 MathVariant getMathvariantAsVariant(); 058 059 /** 060 * Returns parent of this element. 061 * 062 * @return Parent element. 063 */ 064 JEuclidElement getParent(); 065 066 /** 067 * returns true is the child has prescripts attached to it. In this case, 068 * there should be no extra space on the left. 069 * 070 * @param child 071 * child to test 072 * @return true if there are attached prescripts 073 */ 074 boolean hasChildPrescripts(final JEuclidElement child); 075 076 /** 077 * returns true is the child has postscripts attached to it. In this case, 078 * there should be no extra space on the left. 079 * 080 * @param child 081 * child to test 082 * @param context 083 * current layout context. 084 * @return true if there are attached postscripts 085 */ 086 boolean hasChildPostscripts(final JEuclidElement child, 087 LayoutContext context); 088 089 /** 090 * Returns the count of children for this element. 091 * 092 * @return number of children. 093 */ 094 int getMathElementCount(); 095 096 }