IMathElementCollection

All Implemented Interfaces: com.aspose.ms.System.Collections.Generic.IGenericEnumerable

public interface IMathElementCollection extends System.Collections.Generic.IGenericEnumerable<IMathElement>

Represents a collection of mathematical elements (MathElement).


Example:
 
 IMathElementCollection collection = new MathBlock();

Methods

MethodDescription
get_Item(int index)Gets the element at the specified index.
getCount()Gets the number of elements actually contained in the collection.
add(IMathElement item)Adds a math element to the end of the collection.
indexOf(IMathElement item)Determines the index of a specific math element in collection.
insert(int index, IMathElement item)Inserts a math element into the collection at the specified index.
clear()Removes all elements from the collection.
contains(IMathElement item)Determines whether the collection contains a specific value.
remove(IMathElement item)Removes the first occurrence of a specific object from the collection.
removeAt(int index)Removes the element at the specified index of the collection.
copyTo(IMathElement[] array, int arrayIndex)Copy to specified array.

get_Item(int index)

public abstract IMathElement get_Item(int index)

Gets the element at the specified index. Read-only IMathElement.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 IMathElement firstElem = collection.get_Item(0);

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the item to get

Returns: IMathElement

getCount()

public abstract int getCount()

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


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 int count = collection.getCount();

Returns: int

add(IMathElement item)

public abstract void add(IMathElement item)

Adds a math element to the end of the collection.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 collection.add(new MathematicalText("+"));
 collection.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));

Parameters:

ParameterTypeDescription
itemIMathElementThe IMathElement to be added to the end of the collection.

indexOf(IMathElement item)

public abstract int indexOf(IMathElement item)

Determines the index of a specific math element in collection.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 MathematicalText plusElement = new MathematicalText("+");
 collection.add(plusElement);
 collection.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
 int index = collection.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 abstract void insert(int index, IMathElement item)

Inserts a math element into the collection at the specified index.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 MathematicalText plusElement = new MathematicalText("+");
 collection.add(plusElement);
 collection.insert(0, new MathRadical(new MathematicalText("x"), new MathematicalText("3")));

Parameters:

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

clear()

public abstract void clear()

Removes all elements from the collection.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 collection.clear();

contains(IMathElement item)

public abstract boolean contains(IMathElement item)

Determines whether the collection contains a specific value.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 MathematicalText plusElement = new MathematicalText("+");
 collection.add(plusElement);
 collection.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
 bool contains = collection.contains(plusElement);

Parameters:

ParameterTypeDescription
itemIMathElementThe object to locate in the collection.

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

remove(IMathElement item)

public abstract boolean remove(IMathElement item)

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


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 MathematicalText plusElement = new MathematicalText("+");
 collection.add(plusElement);
 collection.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
 collection.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.

removeAt(int index)

public abstract void removeAt(int index)

Removes the element at the specified index of the collection.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 MathematicalText plusElement = new MathematicalText("+");
 collection.add(plusElement);
 collection.insert(0, new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
 collection.removeAt(2);

Parameters:

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

copyTo(IMathElement[] array, int arrayIndex)

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

Copy to specified array.


Example:
 
 IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
 MathematicalText plusElement = new MathematicalText("+");
 collection.add(plusElement);
 collection.add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
 IMathElement[] destinationArray = new IMathElement[collection.Count];
 collection.copyTo(destinationArray, 0);

Parameters:

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