MathBlock

Inheritance: java.lang.Object, com.aspose.slides.MathElementBase

All Implemented Interfaces: com.aspose.slides.IMathBlock, com.aspose.slides.IDOMObject

public final class MathBlock extends MathElementBase implements IMathBlock, IDOMObject

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();

Constructors

ConstructorDescription
MathBlock()Initializes a new instance of the MathBlock class.
MathBlock(IMathElement mathElement)Creates a new mathematical block and puts specified element in it
MathBlock(System.Collections.Generic.IGenericEnumerable mathElements)Creates a new mathematical block and puts specified elements in it

Methods

MethodDescription
getCount()Gets the number of child math elements actually contained in the collection.
get_Item(int index)Gets or sets IMathElement at the specified index.
set_Item(int index, IMathElement value)Gets or sets IMathElement at the specified index.
isReadOnly()Returns false because child elements collection can be modified.
getChildren()Get children elements
getParent_Immediate()Returns Parent_Immediate object.
add(IMathElement item)Adds a math element to the end of the collection.
clear()Removes all elements from the collection.
contains(IMathElement item)Determines whether the collection contains a specific value.
copyTo(IMathElement[] array, int arrayIndex)Copy to specified array.
remove(IMathElement item)Removes the first occurrence of a specific object from the collection.
iterator()Returns an enumerator that iterates through the collection.
iteratorJava()Returns a java iterator for the entire collection.
indexOf(IMathElement item)Determines the index of a specific math element in collection.
insert(int index, IMathElement item)Inserts a MathElement into the collection at the specified index.
removeAt(int index)Removes the element at the specified index of the collection.
join(IMathElement mathElement)Joins a mathematical element with this mathematical block
join(String mathText)Joins a mathematical text with this mathematical block
joinBlock(IMathBlock other)Joins another mathematical block with this one
delimit(char separatorCharacter)Delimits child elements with separator character (without the brackets)
enclose(char beginningCharacter, char endingCharacter)Encloses child elements of this block in specified characters such as parenthesis or another characters as framing
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
toMathArray()Puts child elements in a vertical array
writeAsMathMl(OutputStream stream)Saves content of this MathBlock as MathML

MathBlock()

public MathBlock()

Initializes a new instance of the MathBlock class.


Example:
 
 MathBlock mathBlock = new MathBlock();

MathBlock(IMathElement mathElement)

public MathBlock(IMathElement mathElement)

Creates a new mathematical block and puts specified element in it


Example:
 
 MathBlock mathBlock = new MathBlock(new MathematicalText("x"));

Parameters:

ParameterTypeDescription
mathElementIMathElementThe mathematical element to put in the block

MathBlock(System.Collections.Generic.IGenericEnumerable mathElements)

public MathBlock(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:

ParameterTypeDescription
mathElementscom.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.slides.IMathElement>Mathematical elements to put in the block

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();

Returns: int

get_Item(int index)

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);

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the item

Returns: IMathElement - The mathematical element.

set_Item(int index, IMathElement value)

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:

ParameterTypeDescription
indexintThe zero-based index of the item
valueIMathElementThe mathematical element.

isReadOnly()

public final boolean isReadOnly()

Returns false because child elements collection can be modified.

Returns: boolean

getChildren()

public final IMathElement[] getChildren()

Get children elements

Returns: com.aspose.slides.IMathElement[]

getParent_Immediate()

public final IDOMObject getParent_Immediate()

Returns Parent_Immediate object. Read-only IDOMObject.

Returns: com.aspose.slides.IDOMObject

add(IMathElement item)

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")));

Parameters:

ParameterTypeDescription
itemIMathElementThe 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();

contains(IMathElement item)

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")));
 boolean contains = mathBlock.Contains(plusElement);

Parameters:

ParameterTypeDescription
itemIMathElementThe object to locate in the collection.

Returns: boolean - true if item is found in the collection; otherwise, false.

copyTo(IMathElement[] array, int arrayIndex)

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);

Parameters:

ParameterTypeDescription
arrayIMathElement[]Array to copy to.
arrayIndexintIndex to begin copying.

remove(IMathElement item)

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);

Parameters:

ParameterTypeDescription
itemIMathElementThe object to remove from the collection.

Returns: boolean - 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 System.Collections.Generic.IGenericEnumerator<IMathElement> iterator()

Returns an enumerator that iterates through the collection.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.slides.IMathElement> - A IGenericEnumerator that can be used to iterate through the collection.

iteratorJava()

public final System.Collections.IEnumerator iteratorJava()

Returns a java iterator for the entire collection.

Returns: com.aspose.ms.System.Collections.IEnumerator - An java.util.Iterator for the entire collection.

indexOf(IMathElement item)

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);

Parameters:

ParameterTypeDescription
itemIMathElementThe element to locate in the collection.

Returns: int - The index of item if found in the collection; otherwise, -1.

insert(int index, IMathElement item)

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")));

Parameters:

ParameterTypeDescription
indexintThe zero-based index at which MathElement should be inserted.
itemIMathElementThe MathElement to insert.

removeAt(int index)

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);

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the element to remove.

join(IMathElement mathElement)

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);

Parameters:

ParameterTypeDescription
mathElementIMathElementThe element to be joined

Returns: IMathBlock - The current instance of IMathBlock

join(String mathText)

public IMathBlock join(String mathText)

Joins a mathematical text with this mathematical block


Example:
 
 IMathElement element = new MathematicalText("x");
 IMathBlock block = element.join("+y");

Parameters:

ParameterTypeDescription
mathTextjava.lang.StringMathematical text to be joined

Returns: IMathBlock - A new IMathBlock containing this instance and specified argument

joinBlock(IMathBlock other)

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);

Parameters:

ParameterTypeDescription
otherIMathBlockThe joining block

Returns: IMathBlock - this mathematical block after joining

delimit(char separatorCharacter)

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('|');

Parameters:

ParameterTypeDescription
separatorCharactercharSeparator character

Returns: IMathDelimiter - The math element of type IMathDelimiter

enclose(char beginningCharacter, char endingCharacter)

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('[', ']');

Parameters:

ParameterTypeDescription
beginningCharactercharBeginning character (usually left bracket)
endingCharactercharEnding character (usually right bracket)

Returns: IMathDelimiter - The math element of type IMathDelimiter which includes specified characters as framing

enclose(char beginningCharacter, char endingCharacter, char separatorCharacter)

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('{', '}', '%');

Parameters:

ParameterTypeDescription
beginningCharactercharBeginning character (usually left bracket)
endingCharactercharEnding character (usually right bracket)
separatorCharactercharSeparator character

Returns: IMathDelimiter - The math element of type IMathDelimiter which includes specified characters as framing and delimiter

toMathArray()

public IMathArray toMathArray()

Puts child elements in a vertical array


Example:
 
 IMathArray array = new MathematicalText("x1").join("x2").join("x3").toMathArray();

Returns: IMathArray - New instance of type IMathArray

writeAsMathMl(OutputStream stream)

public final void writeAsMathMl(OutputStream stream)

Saves content of this MathBlock as MathML

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamTarget stream