Skip to content

Commit

Permalink
#478 removed nested classes
Browse files Browse the repository at this point in the history
  • Loading branch information
svendiedrichsen committed Dec 5, 2017
1 parent 22ef973 commit d09c454
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 89 deletions.
84 changes: 0 additions & 84 deletions src/main/java/org/cactoos/iterable/RangeOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,88 +73,4 @@ public T next() {
));
}

/**
* Implements an integer range.
*/
public static class Integer extends RangeOf<java.lang.Integer> {
/**
* Ctor.
* @param min Minimum integer value.
* @param max Maximum integer value.
* @param incrementor Increments the integer value.
*/
public Integer(
final java.lang.Integer min,
final java.lang.Integer max,
final Func<java.lang.Integer, java.lang.Integer> incrementor) {
super(min, max, incrementor);
}
/**
* Ctor. Uses a default increment of 1.
* @param min Minimum integer value.
* @param max Maximum integer value.
*/
public Integer(
final java.lang.Integer min,
final java.lang.Integer max) {
super(min, max, value -> ++value);
}
}

/**
* Implements an long range.
*/
public static class Long extends RangeOf<java.lang.Long> {
/**
* Ctor.
* @param min Minimum long value.
* @param max Maximum long value.
* @param incrementor Increments the long value.
*/
public Long(
final java.lang.Long min,
final java.lang.Long max,
final Func<java.lang.Long, java.lang.Long> incrementor) {
super(min, max, incrementor);
}
/**
* Ctor. Uses a default increment of 1.
* @param min Minimum long value.
* @param max Maximum long value.
*/
public Long(
final java.lang.Long min,
final java.lang.Long max) {
super(min, max, value -> ++value);
}
}

/**
* Implements an character range.
*/
public static class Character extends RangeOf<java.lang.Character> {
/**
* Ctor.
* @param min Minimum character value.
* @param max Maximum character value.
* @param incrementor Increments the character value.
*/
public Character(
final java.lang.Character min,
final java.lang.Character max,
final Func<java.lang.Character, java.lang.Character> incrementor) {
super(min, max, incrementor);
}
/**
* Ctor. Uses a default increment of 1.
* @param min Minimum character value.
* @param max Maximum character value.
*/
public Character(
final java.lang.Character min,
final java.lang.Character max) {
super(min, max, value -> ++value);
}
}

}
8 changes: 4 additions & 4 deletions src/test/java/org/cactoos/iterable/RangeOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final void testIntegerRange() {
MatcherAssert.assertThat(
"Can't generate a range of integers",
new CollectionOf<>(
new RangeOf.Integer(1, 5)
new RangeOf<>(1, 5, value -> ++value)
),
Matchers.contains(1, 2, 3, 4, 5)
);
Expand All @@ -58,7 +58,7 @@ public final void testIntegerFibonacciRange() {
MatcherAssert.assertThat(
"Can't generate a range of fibonacci integers",
new CollectionOf<>(
new RangeOf.Integer(
new RangeOf<>(
1,
100,
new Func<Integer, Integer>() {
Expand All @@ -82,7 +82,7 @@ public final void testLongRange() {
MatcherAssert.assertThat(
"Can't generate a range of long",
new CollectionOf<>(
new RangeOf.Long(1L, 5L)
new RangeOf<>(1L, 5L, value -> ++value)
),
Matchers.contains(1L, 2L, 3L, 4L, 5L)
);
Expand All @@ -93,7 +93,7 @@ public final void testCharacterRange() {
MatcherAssert.assertThat(
"Can't generate a range of characters",
new CollectionOf<>(
new RangeOf.Character('a', 'c')
new RangeOf<>('a', 'c', value -> ++value)
),
Matchers.contains('a', 'b', 'c')
);
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/org/cactoos/scalar/ReducedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public void skipIterable() throws Exception {
"Can't reduce elements in iterable",
new Reduced<>(
0L, (first, second) -> first + second,
new Limited<>(10, new RangeOf.Long(0L, Long.MAX_VALUE))
new Limited<>(
10,
new RangeOf<>(0L, Long.MAX_VALUE, value -> ++value)
)
).value(),
Matchers.equalTo(45L)
);
Expand Down

0 comments on commit d09c454

Please sign in to comment.