astl
Version:
AssemblyScript-STL (Standard Template Library, migrated from the C++)
47 lines (41 loc) • 864 B
text/typescript
export class Repeater<T>
{
private index_: usize;
private readonly value_: T;
public constructor(index: usize, value: T)
{
this.index_ = index;
this.value_ = value;
}
public index(): usize
{
return this.index_;
}
public get value(): T
{
return this.value_;
}
public next(): Repeater<T>
{
++this.index_;
return this;
}
public equals(obj: Repeater<T>): boolean
{
const ret: boolean = this.index_ === obj.index_;
if (ret === true)
this.index_ = 0;
return ret;
}
protected __non_equals(obj: Repeater<T>): boolean
{
return !this.equals(obj);
}
}