Libraries.Containers.Support.ArrayIterator Documentation

The ArrayIterator class for Arrays, enables iteration for the array data structure. Generally, there is no need to use this class directly, as most users will only need an instance of the parent, the Iterator class.

Example Code

use Libraries.Containers.Blueprints.ArrayIterator

class Main
    action main
        Array<integer> myArray
        ArrayIterator<Array<integer>> arrayIt = myArray:GetIterator()
    end
end

Inherits from: Libraries.Language.Object, Libraries.Containers.Iterator

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetArray()This action gets the array that the iterator has.
GetCurrent()This action gets the current item in the iteration without continuing the iteration.
GetHashCode()This action gets the hash code for an object.
HasNext()This action determines if there is a next item in the iteration.
Next()This action get the next item in the iteration.
Rewind()This action starts the iteration over from the beginning.
Set(Libraries.Containers.Array<Type> newArray)This action sets the array parameters up for the iterator.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetArray()

This action gets the array that the iterator has.

Example Code

use Libraries.Containers.Array
        use Libraries.Containers.Iterator
        use Libraries.Containers.Support.ArrayIterator

        Array<integer> myArray
        ArrayIterator<integer> arrayIterator = cast(ArrayIterator, myArray:GetIterator())
        Array<integer> array = arrayIterator:GetArray()

Return

Libraries.Containers.Array: The array.

GetCurrent()

This action gets the current item in the iteration without continuing the iteration.

Example Code

use Libraries.Containers.Array
        use Libraries.Containers.Iterator
        Array<integer> myArray
        Iterator<integer> arrayIterator = myArray:GetIterator()
        integer item = arrayIterator:GetCurrent()

Return

Libraries.Language.Object: The current item in the iteration.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

HasNext()

This action determines if there is a next item in the iteration. It returns true if there is a next and false if there is not.

Example Code

use Libraries.Containers.Array
        use Libraries.Containers.Iterator
        Array<Array<integer>> myArray
        Iterator<Array<integer>> arrayIterator = myArray:GetIterator()
        
        if arrayIterator:HasNext()
            arrayIterator:Next()
        end

Return

boolean: True if there is a next in the iteration and false if there is not.

Next()

This action get the next item in the iteration.

Example Code

use Libraries.Containers.Array
        use Libraries.Containers.Iterator
        Array<integer> myArray
        Iterator<integer> arrayIterator = myArray:GetIterator()
        integer item = arrayIterator:Next()

Return

Libraries.Language.Object: The next item in the iteration.

Rewind()

This action starts the iteration over from the beginning.

Example Code

use Libraries.Containers.Array
        use Libraries.Containers.Iterator
        Array<Array<integer>> myArray
        Iterator<Array<integer>> arrayIterator = myArray:GetIterator()
        
        if arrayIterator:HasNext()
            arrayIterator:Next()
        end

        arrayIterator:Rewind()

Set(Libraries.Containers.Array<Type> newArray)

This action sets the array parameters up for the iterator.

Example Code

use Libraries.Containers.Array
        use Libraries.Containers.Iterator
        use Libraries.Containers.Support.ArrayIterator
        
        Array<integer> myArray
        ArrayIterator<integer> iterator
        iterator:Set(myArray)

Parameters