com.aspose.slides

Interfaces

Classes

Exceptions

com.aspose.slides

Class MathBlock

  • All Implemented Interfaces:
    com.aspose.ms.System.Collections.Generic.IGenericEnumerable<IMathElement>, com.aspose.ms.System.Collections.IEnumerable<IMathElement>, IMathBlock, IMathElement, IMathElementCollection, java.lang.Iterable<IMathElement>


    public final class MathBlock
    extends MathElementBase
    implements IMathBlock

    Specifies an instance of mathematical text that contained within a MathParagraph and starts on its own line. All math zones, including equations, expressions, arrays of equations or expressions, and formulas are represented by math block.


    Example:
     
     MathBlock mathBlock = new MathBlock();
     
    • Constructor Detail

      • MathBlock

        public MathBlock()

        Initializes a new instance of the MathBlock class.


        Example:
         
         MathBlock mathBlock = new MathBlock();
         
      • MathBlock

        public MathBlock(IMathElement mathElement)

        Creates a new mathematical block and puts specified element in it


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         
        Parameters:
        mathElement - The mathematical element to put in the block
      • MathBlock

        public MathBlock(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<IMathElement> mathElements)

        Creates a new mathematical block and puts specified elements in it


        Example:
         
         var elems = new IMathElement[2] { new MathematicalText("item1"), new MathematicalText("item2") };
         MathBlock mathBlock = new MathBlock(elems);
         
        Parameters:
        mathElements - Mathematical elements to put in the block
    • Method Detail

      • getCount

        public final int getCount()

        Gets the number of child math elements actually contained in the collection. Read-only int.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         int count = mathBlock.getCount();
         
        Specified by:
        getCount in interface IMathElementCollection
      • get_Item

        public final IMathElement get_Item(int index)

        Gets or sets IMathElement at the specified index.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         IMathElement firstElem = mathBlock.get_Item(0);
         
        Specified by:
        get_Item in interface IMathElementCollection
        Parameters:
        index - The zero-based index of the item
      • set_Item

        public final void set_Item(int index,
                                   IMathElement value)

        Gets or sets IMathElement at the specified index.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         IMathElement firstElem = mathBlock.get_Item(0);
         
        Parameters:
        index - The zero-based index of the item
      • isReadOnly

        public final boolean isReadOnly()

        Returns false because child elements collection can be modified.

      • getParent_Immediate

        public final com.aspose.slides.IDOMObject getParent_Immediate()

        Returns Parent_Immediate object. Read-only IDOMObject.

        Overrides:
        getParent_Immediate in class MathElementBase
      • add

        public final void add(IMathElement item)

        Adds a math element to the end of the collection.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         mathBlock.add(new MathematicalText("+"));
         mathBlock.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
         
        Specified by:
        add in interface IMathElementCollection
        Parameters:
        item - The IMathElement to be added to the end of the collection.
      • clear

        public final void clear()

        Removes all elements from the collection.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         mathBlock.clear();
         
        Specified by:
        clear in interface IMathElementCollection
      • contains

        public final boolean contains(IMathElement item)

        Determines whether the collection contains a specific value.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         MathematicalText plusElement = new MathematicalText("+");
         mathBlock.add(plusElement);
         mathBlock.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
         bool contains = mathBlock.contains(plusElement);
         
        Specified by:
        contains in interface IMathElementCollection
        Parameters:
        item - The object to locate in the collection.
        Returns:
        true if item is found in the collection; otherwise, false.
      • copyTo

        public final void copyTo(IMathElement[] array,
                                 int arrayIndex)

        Copy to specified array.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         MathematicalText plusElement = new MathematicalText("+");
         mathBlock.add(plusElement);
         mathBlock.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
         IMathElement[] destinationArray = new IMathElement[mathBlock.Count];
         mathBlock.copyTo(destinationArray, 0);
         
        Specified by:
        copyTo in interface IMathElementCollection
        Parameters:
        array - Array to copy to.
        arrayIndex - Index to begin copying.
      • remove

        public final boolean remove(IMathElement item)

        Removes the first occurrence of a specific object from the collection.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         MathematicalText plusElement = new MathematicalText("+");
         mathBlock.Add(plusElement);
         mathBlock.Add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
         mathBlock.Remove(plusElement);
         
        Specified by:
        remove in interface IMathElementCollection
        Parameters:
        item - The object to remove from the collection.
        Returns:
        true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the original collection.
      • iterator

        public final com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IMathElement> iterator()

        Returns an enumerator that iterates through the collection.

        Specified by:
        iterator in interface com.aspose.ms.System.Collections.Generic.IGenericEnumerable<IMathElement>
        Specified by:
        iterator in interface com.aspose.ms.System.Collections.IEnumerable<IMathElement>
        Specified by:
        iterator in interface java.lang.Iterable<IMathElement>
        Returns:
        A System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection.
      • iteratorJava

        public final com.aspose.ms.System.Collections.IEnumerator iteratorJava()

        Returns a java iterator for the entire collection.

        Returns:
        An Iterator for the entire collection.
      • indexOf

        public final int indexOf(IMathElement item)

        Determines the index of a specific math element in collection.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         MathematicalText plusElement = new MathematicalText("+");
         mathBlock.add(plusElement);
         mathBlock.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
         int index = mathBlock.indexOf(plusElement);
         
        Specified by:
        indexOf in interface IMathElementCollection
        Parameters:
        item - The element to locate in the collection.
        Returns:
        The index of item if found in the collection; otherwise, -1.
      • insert

        public final void insert(int index,
                                 IMathElement item)

        Inserts a MathElement into the collection at the specified index.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         MathematicalText plusElement = new MathematicalText("+");
         mathBlock.add(plusElement);
         mathBlock.insert(0, new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
         
        Specified by:
        insert in interface IMathElementCollection
        Parameters:
        index - The zero-based index at which MathElement should be inserted.
        item - The MathElement to insert.
      • removeAt

        public final void removeAt(int index)

        Removes the element at the specified index of the collection.


        Example:
         
         MathBlock mathBlock = new MathBlock(new MathematicalText("x"));
         MathematicalText plusElement = new MathematicalText("+");
         mathBlock.add(plusElement);
         mathBlock.insert(0, new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
         mathBlock.removeAt(2);
         
        Specified by:
        removeAt in interface IMathElementCollection
        Parameters:
        index - The zero-based index of the element to remove.
      • join

        public IMathBlock join(IMathElement mathElement)

        Joins a mathematical element with this mathematical block


        Example:
         
         IMathElement element1 = new MathematicalText("x");
         IMathElement element2 = new MathematicalText("y");
         IMathBlock block = element1.join(element2);
         
        Specified by:
        join in interface IMathElement
        Overrides:
        join in class MathElementBase
        Parameters:
        mathElement - The element to be joined
        Returns:
        The current instance of IMathBlock
      • join

        public IMathBlock join(java.lang.String mathText)

        Joins a mathematical text with this mathematical block


        Example:
         
         IMathElement element = new MathematicalText("x");
         IMathBlock block = element.join("+y");
         
        Specified by:
        join in interface IMathElement
        Overrides:
        join in class MathElementBase
        Parameters:
        mathText - Mathematical text to be joined
        Returns:
        A new IMathBlock containing this instance and specified argument
      • joinBlock

        public final IMathBlock joinBlock(IMathBlock other)

        Joins another mathematical block with this one


        Example:
         
         IMathBlock block1 = new MathSuperscriptElement(new MathematicalText("c"), new MathematicalText("2")).join(new MathematicalText("="));
         IMathBlock block2 = new MathSuperscriptElement(new MathematicalText("a"), new MathematicalText("2")).join(new MathematicalText("+"))
         .join(new MathSuperscriptElement(new MathematicalText("b"), new MathematicalText("2")));
         IMathBlock block3 = block1.joinBlock(block2);
         
        Specified by:
        joinBlock in interface IMathBlock
        Parameters:
        other - The joining block
        Returns:
        this mathematical block after joining
      • delimit

        public final IMathDelimiter delimit(char separatorCharacter)

        Delimits child elements with separator character (without the brackets)


        Example:
         
         MathBlock mathBlock = new MathematicalText("x").join("y");
         IMathDelimiter delimiterElement = mathBlock.delimit('|');
         
        Specified by:
        delimit in interface IMathBlock
        Parameters:
        separatorCharacter - Separator character
        Returns:
        The math element of type IMathDelimiter
      • enclose

        public IMathDelimiter enclose(char beginningCharacter,
                                      char endingCharacter)

        Encloses child elements of this block in specified characters such as parenthesis or another characters as framing


        Example:
         
         IMathBlock block = new MathematicalText("x").join("+y");
         IMathDelimiter delimiter = block.enclose('[', ']');
         
        Specified by:
        enclose in interface IMathElement
        Overrides:
        enclose in class MathElementBase
        Parameters:
        beginningCharacter - Beginning character (usually left bracket)
        endingCharacter - Ending character (usually right bracket)
        Returns:
        The math element of type IMathDelimiter which includes specified characters as framing
      • enclose

        public final IMathDelimiter enclose(char beginningCharacter,
                                            char endingCharacter,
                                            char separatorCharacter)

        Encloses child elements of this block in specified characters such as parenthesis or another as framing and delimit with a separator character


        Example:
         
         IMathBlock mathBlock = new MathematicalText("x").join("y");
         IMathDelimiter delimiterElement = mathBlock.enclose('{', '}', '%');
         
        Specified by:
        enclose in interface IMathBlock
        Parameters:
        beginningCharacter - Beginning character (usually left bracket)
        endingCharacter - Ending character (usually right bracket)
        separatorCharacter - Separator character
        Returns:
        The math element of type IMathDelimiter which includes specified characters as framing and delimiter
      • writeAsMathMl

        public final void writeAsMathMl(java.io.OutputStream stream)

        Saves content of this MathBlock as MathML

        Specified by:
        writeAsMathMl in interface IMathBlock
        Parameters:
        stream - Target stream