abstract class Phase::StrideIterator(I)

Overview

A coordinate iterator that advances to the next value by taking orthogonal strides. The only iteration orders that obey that criteria are lexicographic, colexicographic, and their reverses.

Included Modules

Direct Known Subclasses

Defined in:

iterators/stride_iterator.cr

Constructors

Class Method Summary

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(idx_r : IndexRegion(I)) #

Constructs an iterator that will provide every coordinate described by an IndexRegion.


[View source]
def self.new(region_literal : Indexable(I)) forall I #

Constructs an iterator that will provide every coordinate described by a region literal.


[View source]

Class Method Detail

def self.cover(shape : Indexable(I)) forall I #

Constructs an iterator that will provide every coordinate within shape.


[View source]
def self.cover(src : MultiIndexable) #

Constructs an iterator that will provide every coordinate in src.shape.


[View source]

Macro Detail

macro def_standard_clone #

[View source]

Instance Method Detail

abstract def advance! : Array(I) | Stop #

Advances the internal state of this StrideIterator and returns the new coord (or Iterator::Stop if iteration is finished).


[View source]
def largest_coord : Indexable(I) | Nil #

Returns a coordinate that stores the largest possible value this StrideIterator can output in each ordinate. If there are no coordinates contained in this IndexRegion (e.g. IndexRegion[0...0]), returns null.


[View source]
def next : ReadonlyWrapper(Array(I), I) | Stop #
Description copied from module Iterator(Indexable(I))

Returns the next element in this iterator, or Iterator::Stop::INSTANCE if there are no more elements.


[View source]
def reset! #

[View source]
def reverse! #

Reverses the direction of iteration in-place.


[View source]
def to_a : Array(Indexable(I)) #

Returns an ordered Array of all coordinates this StrideIterator will cover.


[View source]
def unsafe_next : Indexable(I) #

Returns #next typecast to an Indexable(I). This will raise if the iterator returns Stop.


[View source]