Click or drag to resize

IGeneratorTResult Interface

All generic generators implement this interface.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
[VersionAttribute(2, 0, 0)]
public interface IGenerator<out TResult> : IGenerator

Type Parameters

TResult
The type of the elements the generator generates.

The IGeneratorTResult type exposes the following members.

Properties
  NameDescription
Public propertyCurrent
Gets the element last generated by this generator.
Top
Methods
  NameDescription
Public methodCloneAndRestart
Clones the generator and returns the clone in a restarted state.
Public methodMoveNext
Generates the next element.
(Inherited from IGenerator.)
Top
Extension Methods
  NameDescription
Public Extension MethodAggregateTSource(FuncTSource, TSource, TSource)Overloaded.
Makes a generator that generates a running aggregate of the source generator.
(Defined by Generator.)
Public Extension MethodAggregateTSource(FuncTSource, TSource, TSource, TSource)Overloaded.
Makes a generator that generates a running aggregate of the source generator.
(Defined by Generator.)
Public Extension MethodCode exampleAggregateTSource, TResult(FuncTResult, TSource, TResult, TResult)Overloaded.
Makes a generator that generates a running aggregate of the source generator.
(Defined by Generator.)
Public Extension MethodCode exampleApplyTSource
Makes a generator that applies a function on the elements it generates.
(Defined by Generator.)
Public Extension MethodCastTResult
Makes a generator that will generate elements by casting the elements of a source generator.
(Defined by Generator.)
Public Extension MethodGroupTSource(Int32)Overloaded.
Makes a generator that returns groups of elements from the source generator.
(Defined by Generator.)
Public Extension MethodGroupTSource(IGeneratorInt32)Overloaded.
Makes a generator that generates groups of items from the source generator.
(Defined by Generator.)
Public Extension MethodCode exampleInterpolateTSource(Int32, FuncTSource, TSource, Single, TSource)Overloaded.
Makes a generator that interpolates between values of a given generator.
(Defined by Generator.)
Public Extension MethodInterpolateTSource(IGeneratorInt32, FuncTSource, TSource, Single, TSource)Overloaded.
Makes a generator that interpolates between values of a given generator.
(Defined by Generator.)
Public Extension MethodInterpolateDitherTSource
Interpolates a sequence, but applies dithering.
(Defined by Generator.)
Public Extension MethodLogTSourceOverloaded.
A generator that generates the elements of the source generator, but sends the generated element to the Unity Console.
(Defined by Generator.)
Public Extension MethodCode exampleLogTSource(ActionTSource)Overloaded.
A generator that generates the elements of the source generator, but applies a log function to each element as it is generated.
(Defined by Generator.)
Public Extension MethodMoveNextTSource
Moves the generator by a specified amount forward.
(Defined by Generator.)
Public Extension MethodNextTSourceOverloaded.
Returns the next element of the specified generator.
(Defined by Generator.)
Public Extension MethodNextTSource(Int32)Overloaded.
Returns a list of the next n items from the generator.
(Defined by Generator.)
Public Extension MethodCode exampleNextWhileTSource
Generates the elements from the generator while the predicate applied to elements hold an return them in an enumerable. After calling this method, the next element returned by Next (or the current value of Current) will not satisfy the predicate.
(Defined by Generator.)
Public Extension MethodOfTypeTResult
Makes a generator that will generate elements of a source generator that is of the given type.
(Defined by Generator.)
Public Extension MethodCode examplePadTSource(IEnumerableTSource)Overloaded.
Pads the specified generator with elements from a given list.
(Defined by Generator.)
Public Extension MethodCode examplePadTSource(TSource, Int32)Overloaded.
Pads the specified generator with a constant element repeated a specified number of times.
(Defined by Generator.)
Public Extension MethodRepeatEachTSource(Int32)Overloaded.
Makes a new generator that will repeat each of the given generators elements a number of times.
(Defined by Generator.)
Public Extension MethodRepeatEachTSource(IGeneratorInt32)Overloaded.
Makes a new generator that will repeat each of the given generators elements a number of times.
(Defined by Generator.)
Public Extension MethodSelectTSource, TResult
Makes a generator which generates items that are transformed, generated from a given generator.
(Defined by Generator.)
Public Extension MethodSelectManyTSource, TResult
For each item in the source generator, a list of items is generated, but the items are generated one by one (and not as a list of items).
(Defined by Generator.)
Public Extension MethodCode exampleSkipTSource
Makes a generator that skips over the specified number of elements from the source generator.
(Defined by Generator.)
Public Extension MethodCode exampleSkipAndTakeTSource
Makes a generator that repeatedly skips over and takes elements from a given generator.
(Defined by Generator.)
Public Extension MethodSwitchAfterTSource
Generates elements from a source generator for the given number of steps, then switches to a second generator.
(Defined by Generator.)
Public Extension MethodSwitchWhenTSource
Generates elements from the source generator until a condition is met, then generate elements from a second generator.
(Defined by Generator.)
Public Extension MethodCode exampleTakeAndSkipTSource
Makes a generator that repeatedly takes and skips over elements from a given generator.
(Defined by Generator.)
Public Extension MethodWhereTSource(FuncTSource, Boolean)Overloaded.
Makes a generator that will only generate elements that pass the predicate.
(Defined by Generator.)
Public Extension MethodWhereTSource(IGeneratorBoolean)Overloaded.
Makes a generator that will only generate elements that pass the predicate generated by the predicate generator.
(Defined by Generator.)
Public Extension MethodWhereT(FuncT, Boolean, Int32)Overloaded.
Makes a generator that will only generate elements that pass the predicate. If the source elements does not provide elements that pass the predicate for the given number of maximum iterations, an exception is thrown. This is to prevent a stalling the generator forever.
(Defined by Generator.)
Public Extension MethodWhereT(IGeneratorBoolean, Int32)Overloaded.
Makes a generator that will only generate elements that pass the predicate generated by the predicate generator. If the source elements does not provide elements that pass the predicate for the given number of maximum iterations, an exception is thrown. This is to prevent a stalling the generator forever.
(Defined by Generator.)
Public Extension MethodWhereWindowTSource
Only generates an item if the window of the item passes the predicate.
(Defined by Generator.)
Public Extension MethodCode exampleWindowTSource
Makes a generator that generates a moving window of elements over a given generator.
(Defined by Generator.)
Top
Remarks
To correctly implement this interface:
  • A call to Current immediately after constructing the class must give the first element of the generator. This is in contrast to IEnumerator, where a call to MoveNext must be made first.
  • Calls to Current must always give a valid element, no matter how many times MoveNext has been called. Generators never end.
  • Calls to Current must always give the same value until the next call to MoveNext is made.
  • MoveNext must make all computations to generate the next element. In general, a private variable holds the current value, is calculated in this method, and returned by Current.
  • Generators that are built from other generators must CloneAndRestart the generators and store the clones. This ensures calls to MoveNext in this generator won't affect elements generated by a generated passed in as an argument in the constructor.
  • The generator must store all information needed to be able to produce an equivalent generator in CloneAndRestart. Generally, generators are equivalent when they generate the same elements (in the same order). There are some exceptions, for example, unseeded random number generators. It is not necessary to CloneAndRestart generators stored internally when creating a new instance of the generator, since that should be done in the constructor.
See Also