Class MathMLMathElementImpl

java.lang.Object
org.apache.xerces.dom.NodeImpl
org.apache.xerces.dom.ChildNode
org.apache.xerces.dom.ParentNode
org.apache.xerces.dom.ElementImpl
org.apache.xerces.dom.ElementNSImpl
org.episteme.core.mathematics.loaders.mathml.MathMLElementImpl
org.episteme.core.mathematics.loaders.mathml.MathMLMathElementImpl
All Implemented Interfaces:
Serializable, Cloneable, Element, ElementTraversal, EventTarget, MathMLContainer, MathMLElement, MathMLMathElement, MathMLNodeList, Node, NodeList, TypeInfo

public class MathMLMathElementImpl extends MathMLElementImpl implements MathMLMathElement
Implements a MathML math element.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Constructor Details

    • MathMLMathElementImpl

      public MathMLMathElementImpl(MathMLDocumentImpl owner, String qualifiedName)
      Constructs a MathML math element.
      Parameters:
      owner - the document that owns this element
      qualifiedName - the qualified name of the element
  • Method Details

    • getMacros

      public String getMacros()
      Gets the macros attribute of the math element.
      Specified by:
      getMacros in interface MathMLMathElement
      Returns:
      the macros string
    • setMacros

      public void setMacros(String macros)
      Sets the macros attribute of the math element.
      Specified by:
      setMacros in interface MathMLMathElement
      Parameters:
      macros - the new macros string
    • getDisplay

      public String getDisplay()
      Gets the display attribute of the math element.
      Specified by:
      getDisplay in interface MathMLMathElement
      Returns:
      the display mode (e.g., "block" or "inline")
    • setDisplay

      public void setDisplay(String display)
      Sets the display attribute of the math element.
      Specified by:
      setDisplay in interface MathMLMathElement
      Parameters:
      display - the new display mode
    • getNArguments

      public int getNArguments()
      Gets the number of arguments (child elements that are not declarations).
      Specified by:
      getNArguments in interface MathMLContainer
      Returns:
      the argument count
    • getArguments

      public MathMLNodeList getArguments()
      Gets the list of arguments (child elements that are not declarations).
      Specified by:
      getArguments in interface MathMLContainer
      Returns:
      the argument list
    • getDeclarations

      public MathMLNodeList getDeclarations()
      Gets the list of declarations within this math element.
      Specified by:
      getDeclarations in interface MathMLContainer
      Returns:
      the declaration list
    • getArgument

      public MathMLElement getArgument(int index) throws DOMException
      Gets a specific argument by index.
      Specified by:
      getArgument in interface MathMLContainer
      Parameters:
      index - the 1-based index of the argument
      Returns:
      the MathML element at the specified index
      Throws:
      DOMException - if the index is out of bounds
    • setArgument

      public MathMLElement setArgument(MathMLElement newArgument, int index) throws DOMException
      Sets or replaces an argument at a specific index.
      Specified by:
      setArgument in interface MathMLContainer
      Parameters:
      newArgument - the new argument element
      index - the 1-based index (if index is length+1, it appends)
      Returns:
      the replaced or appended element
      Throws:
      DOMException - if the index is out of bounds
    • insertArgument

      public MathMLElement insertArgument(MathMLElement newArgument, int index) throws DOMException
      Inserts an argument at a specific index.
      Specified by:
      insertArgument in interface MathMLContainer
      Parameters:
      newArgument - the new argument element
      index - the 1-based index to insert before (0 or length+1 appends)
      Returns:
      the inserted element
      Throws:
      DOMException - if the index is out of bounds
    • removeArgument

      public MathMLElement removeArgument(int index) throws DOMException
      Removes an argument at a specific index.
      Specified by:
      removeArgument in interface MathMLContainer
      Parameters:
      index - the 1-based index of the argument to remove
      Returns:
      the removed element
      Throws:
      DOMException - if the index is out of bounds
    • deleteArgument

      public void deleteArgument(int index) throws DOMException
      Deletes an argument at a specific index.
      Specified by:
      deleteArgument in interface MathMLContainer
      Parameters:
      index - the 1-based index of the argument to delete
      Throws:
      DOMException - if the index is out of bounds
    • getDeclaration

      public MathMLDeclareElement getDeclaration(int index) throws DOMException
      Gets a specific declaration by index.
      Specified by:
      getDeclaration in interface MathMLContainer
      Parameters:
      index - the 1-based index of the declaration
      Returns:
      the declaration element
      Throws:
      DOMException - if the index is out of bounds
    • setDeclaration

      public MathMLDeclareElement setDeclaration(MathMLDeclareElement newDeclaration, int index) throws DOMException
      Sets or replaces a declaration at a specific index.
      Specified by:
      setDeclaration in interface MathMLContainer
      Parameters:
      newDeclaration - the new declaration element
      index - the 1-based index
      Returns:
      the replaced or appended element
      Throws:
      DOMException - if the index is out of bounds
    • insertDeclaration

      public MathMLDeclareElement insertDeclaration(MathMLDeclareElement newDeclaration, int index) throws DOMException
      Inserts a declaration at a specific index.
      Specified by:
      insertDeclaration in interface MathMLContainer
      Parameters:
      newDeclaration - the new declaration element
      index - the 1-based index (0 or length+1 appends)
      Returns:
      the inserted element
      Throws:
      DOMException - if the index is out of bounds
    • removeDeclaration

      public MathMLDeclareElement removeDeclaration(int index) throws DOMException
      Removes a declaration at a specific index.
      Specified by:
      removeDeclaration in interface MathMLContainer
      Parameters:
      index - the 1-based index of the declaration to remove
      Returns:
      the removed element
      Throws:
      DOMException - if the index is out of bounds
    • deleteDeclaration

      public void deleteDeclaration(int index) throws DOMException
      Deletes a declaration at a specific index.
      Specified by:
      deleteDeclaration in interface MathMLContainer
      Parameters:
      index - the 1-based index of the declaration to delete
      Throws:
      DOMException - if the index is out of bounds