Class IntegerRange
java.lang.Object
org.apache.commons.functor.generator.BaseGenerator<Integer>
org.apache.commons.functor.generator.util.IntegerRange
A generator for the range from (inclusive) to to (exclusive).
- Since:
- 1.0
- Version:
- $Revision$ $Date$
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIntegerRange(int from, int to) Create a new IntegerRange.IntegerRange(int from, int to, int step) Create a new IntegerRange.IntegerRange(Number from, Number to) Create a new IntegerRange.IntegerRange(Number from, Number to, Number step) Create a new IntegerRange. -
Method Summary
Modifier and TypeMethodDescriptionprivate static intdefaultStep(int from, int to) Calculate default step to get fromfromtoto.booleaninthashCode()voidrun(UnaryProcedure<? super Integer> proc) Generators must implement this method.private static intsignOf(int value) Getvalue/|value|(0 when value == 0).toString()Methods inherited from class BaseGenerator
getWrappedGenerator, isStopped, stop, to, to, toCollection
-
Field Details
-
from
private final int fromThe start index. -
to
private final int toThe end index. -
step
private final int stepThe increment counter.
-
-
Constructor Details
-
IntegerRange
-
IntegerRange
-
IntegerRange
public IntegerRange(int from, int to) Create a new IntegerRange.- Parameters:
from- startto- end
-
IntegerRange
public IntegerRange(int from, int to, int step) Create a new IntegerRange.- Parameters:
from- startto- endstep- increment
-
-
Method Details
-
run
Generators must implement this method.- Parameters:
proc- UnaryProcedure to run
-
toString
-
equals
-
hashCode
-
signOf
private static int signOf(int value) Getvalue/|value|(0 when value == 0).- Parameters:
value- to test- Returns:
- int
-
defaultStep
private static int defaultStep(int from, int to) Calculate default step to get fromfromtoto.- Parameters:
from- startto- end- Returns:
- int
-