Skip to content

Commit e6234b8

Browse files
committed
Removed deprecated methods from quickcheck
1 parent 3b0f9b9 commit e6234b8

File tree

2 files changed

+5
-67
lines changed

2 files changed

+5
-67
lines changed

quickcheck/src/main/java/fj/test/Gen.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -536,24 +536,6 @@ public static <A> Gen<A> pickOne(List<A> as) {
536536
return wordOf(1, as).map(List::head);
537537
}
538538

539-
/**
540-
* Returns a generator of lists that picks the given number of elements from the given list. If
541-
* the given number is less than zero or greater than the length of the given list, then the
542-
* returned generator will never produce a value.
543-
* <p>
544-
* Note: pick is synonymous with combinationOf
545-
*
546-
* @deprecated As of release 4.6, use {@link #combinationOf}
547-
*
548-
* @param n The number of elements to pick from the given list.
549-
* @param as The list from which to pick elements.
550-
* @return A generator of lists that picks the given number of elements from the given list.
551-
*/
552-
@Deprecated
553-
public static <A> Gen<List<A>> pick(int n, List<A> as) {
554-
return combinationOf(n, as);
555-
}
556-
557539
/**
558540
* Returns a generator of lists that picks the given number of elements from the given list. The selection is
559541
* a combination without replacement of elements from the given list, i.e.
@@ -678,21 +660,6 @@ private static <A> Gen<List<A>> pick(Gen<List<Integer>> indexesGen, Array<A> as)
678660
indexes.foldLeft((acc, index) -> cons(as.get(index), acc), List.<A>nil()).reverse());
679661
}
680662

681-
/**
682-
* Returns a generator of lists that produces some of the values of the given list.
683-
* <p>
684-
* Note: someOf is synonymous with someCombinationOf
685-
*
686-
* @deprecated As of release 4.6, use {@link #someCombinationOf}
687-
*
688-
* @param as The list from which to pick values.
689-
* @return A generator of lists that produces some of the values of the given list.
690-
*/
691-
@Deprecated
692-
public static <A> Gen<List<A>> someOf(List<A> as) {
693-
return someCombinationOf(as);
694-
}
695-
696663
/**
697664
* Returns a generator of lists that produces some of the values of the given list. The selection is
698665
* a combination without replacement of elements from the given list, i.e.

quickcheck/src/main/java/fj/test/Rand.java

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import java.util.Random;
77

8-
import static fj.data.Option.none;
98
import static fj.data.Option.some;
109
import static java.lang.Math.max;
1110
import static java.lang.Math.min;
@@ -18,18 +17,16 @@
1817
public final class Rand {
1918
private final F<Option<Long>, F<Integer, F<Integer, Integer>>> f;
2019
private final F<Option<Long>, F<Double, F<Double, Double>>> g;
21-
22-
// TODO Change to F<Long,Rand> when rand(f,g) is removed
23-
private final Option<F<Long, Rand>> optOnReseed;
20+
private final F<Long, Rand> onReseed;
2421

2522
private Rand(
2623
F<Option<Long>, F<Integer, F<Integer, Integer>>> f,
2724
F<Option<Long>, F<Double, F<Double, Double>>> g,
28-
Option<F<Long, Rand>> optOnReseed) {
25+
F<Long, Rand> onReseed) {
2926

3027
this.f = f;
3128
this.g = g;
32-
this.optOnReseed = optOnReseed;
29+
this.onReseed = onReseed;
3330
}
3431

3532
/**
@@ -88,33 +85,7 @@ public double choose(final double from, final double to) {
8885
* @return A random generator with the given seed.
8986
*/
9087
public Rand reseed(long seed) {
91-
return optOnReseed.<Rand>option(
92-
() -> {
93-
throw new IllegalStateException("reseed() called on a Rand created with deprecated rand() method");
94-
},
95-
onReseed -> onReseed.f(seed));
96-
}
97-
98-
/**
99-
* Constructs a random generator from the given functions that supply a range to produce a
100-
* result.
101-
* <p>
102-
* Calling {@link #reseed(long)} on an instance returned from this method will
103-
* result in an exception being thrown.
104-
*
105-
* @deprecated As of release 4.6, use {@link #rand(F, F, F)}.
106-
*
107-
* @param f The integer random generator.
108-
* @param g The floating-point random generator.
109-
* @return A random generator from the given functions that supply a range to produce a result.
110-
*/
111-
// TODO Change Option<F<Long,Rand>> optOnReseed to F<Long,Road> onReseed when removing this method
112-
@Deprecated
113-
public static Rand rand(
114-
F<Option<Long>, F<Integer, F<Integer, Integer>>> f,
115-
F<Option<Long>, F<Double, F<Double, Double>>> g) {
116-
117-
return new Rand(f, g, none());
88+
return onReseed.f(seed);
11889
}
11990

12091
/**
@@ -131,7 +102,7 @@ public static Rand rand(
131102
F<Option<Long>, F<Double, F<Double, Double>>> g,
132103
F<Long, Rand> onReseed) {
133104

134-
return new Rand(f, g, some(onReseed));
105+
return new Rand(f, g, onReseed);
135106
}
136107

137108
/**

0 commit comments

Comments
 (0)