TimeSeries { public static TimeSeriesGenerator filter(TimeSeriesGenerator tsg, Predicate<List<Double>> predicate) { return new FilteredTSG(tsg, predicate); } private  TimeSeries(); static TimeSeriesGenerator homogenousPoisson(double length,
      int numEvents); static TimeSeriesGenerator nonHomogenousPoisson(double length,
      IntensityFunction function); static TimeSeriesGenerator nonHomogenousPoisson(double length,
      StochasticSupplier<IntensityFunction> functionSupplier); static TimeSeriesGenerator uniform(double length, int numEvents,
      double maxDeviation); static TimeSeriesGenerator uniform(double length, int numEvents,
      StochasticSupplier<Double> maxDeviation); static TimeSeriesGenerator normal(double length, int numEvents,
      double sd); static TimeSeriesGenerator toTimeSeries(double length,
      StochasticSupplier<Double> interArrivalTimesSupplier); static TimeSeriesGenerator filter(TimeSeriesGenerator tsg,
      Predicate<List<Double>> predicate); static Predicate<List<Double>> numEventsPredicate(final int num);  }
@Test public void testFilter() { final TimeSeriesGenerator original = homogenousPoisson(500, 20); final TimeSeriesGenerator filtered = filter(original, numEventsPredicate(20)); final RandomGenerator rng = new MersenneTwister(123L); for (int i = 0; i < 10; i++) { assertEquals(20, filtered.generate(rng.nextLong()).size()); } }