T - The type of objects to iterate.public class CountingIter<T> extends java.lang.Object implements IRanIter<T,CountingIter<T>>
| Constructor and Description |
|---|
CountingIter(CountingIter<T> x)
Constructs a new instance from another iterator.
|
CountingIter(T start)
Constructs a counting iterator that returns consecutive values
on-the-fly whenever it is accessed.
|
CountingIter(T start,
T step)
Constructs a counting iterator that returns consecutive values
on-the-fly whenever it is accessed.
|
| Modifier and Type | Method and Description |
|---|---|
CountingIter<T> |
Add(long offset)
Adds the current iterator and an offset.
|
void |
Advance(int offset)
Adds an offset to an iterator.
|
void |
Advance(long offset)
Adds an offset to an iterator.
|
IteratorCategory |
Category()
Gets the iterator category.
|
int |
compareTo(CountingIter<T> other)
Compares this instance to a specified iterator and
returns an indication of their relative values.
|
CountingIter<T> |
Copy()
Creates and returns a copy of the current instance.
|
T |
Current()
Returns the current value of the iterator.
|
void |
Decrement()
Decrements the iterator.
|
long |
Difference(CountingIter<T> other)
Subtracts a specified iterator from the current one.
|
void |
Dispose()
Performs application-defined tasks associated with freeing, releasing,
or resetting system resources or other cleanup.
|
long |
Distance(CountingIter<T> other)
Determines the number of increments between
this instance and a specified iterator.
|
boolean |
Equals(CountingIter<T> other)
Tests whether this instance is equal to a specified
object.
|
boolean |
equals(java.lang.Object obj)
Tests whether this instance is equal to a specified
object.
|
int |
hashCode()
Returns the hash code for this instance.
|
void |
Increment()
Increments the iterator.
|
long |
Index()
Gets the zero-based position of the element in the array
that is located by the current iterator.
|
CountingIter<T> |
Next()
Returns the next iterator.
|
CountingIter<T> |
Previous()
Returns the previous iterator.
|
void |
ResetBegin()
Used to implement the IOutIter ResetBegin method.
|
void |
ResetEnd()
Used to implement the IOutIter ResetEnd method.
|
void |
SetCurrent(T value)
Returns an exception because the iterator is not mutable.
|
public CountingIter(T start)
start - The initial value to be incremented.public CountingIter(T start, T step)
start - The initial value to be incremented.step - The step that increments the current value.public CountingIter(CountingIter<T> x)
x - The iterator to copy.public void Dispose()
Dispose in interface IDisposablepublic IteratorCategory Category()
Category in interface IBaseIter<CountingIter<T>>public CountingIter<T> Copy()
Copy in interface IBaseIter<CountingIter<T>>public T Current()
Current in interface IInpIter<T,CountingIter<T>>public void SetCurrent(T value)
SetCurrent in interface IOutIter<T,CountingIter<T>>value - The new value for the current element.java.lang.RuntimeException - Thrown because the iterator is not mutable.public void ResetBegin()
ResetBegin in interface IBaseIter<CountingIter<T>>public void ResetEnd()
ResetEnd in interface IBaseIter<CountingIter<T>>public void Increment()
Increment in interface IBaseIter<CountingIter<T>>public void Decrement()
Decrement in interface IBidIter<T,CountingIter<T>>public CountingIter<T> Next()
public CountingIter<T> Previous()
public void Advance(int offset)
Advance in interface IBaseIter<CountingIter<T>>offset - The number of positions the iterator is to be offset.public void Advance(long offset)
Advance in interface IBaseIter<CountingIter<T>>offset - The number of positions the iterator is to be offset.public long Distance(CountingIter<T> other)
Distance in interface IBaseIter<CountingIter<T>>other - An iterator addressing the position
one past the final element in the range [this, other).public CountingIter<T> Add(long offset)
Add in interface IRanIter<T,CountingIter<T>>offset - The number of positions added to the current iterator.public long Difference(CountingIter<T> other)
Difference in interface IRanIter<T,CountingIter<T>>other - An iterator that is to be subtracted from the
current one.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - An object to compare with this instance.public int hashCode()
hashCode in class java.lang.Objectpublic boolean Equals(CountingIter<T> other)
Equals in interface IEquatable<CountingIter<T>>other - An object to compare with this instance.public int compareTo(CountingIter<T> other)
compareTo in interface java.lang.Comparable<CountingIter<T>>other - An iterator to compare.| Less than zero | This instance is less than other. |
| Zero | This instance is equal to other. |
| Greater than zero | This instance is greater than other. |
public long Index()
Copyright© 2012 Progeneric Systems, Inc. All Rights Reserved.