Tabnine Logo
CombinedGenerators.uniqueValues
Code IndexAdd Tabnine to your IDE (free)

How to use
uniqueValues
method
in
net.java.quickcheck.generator.CombinedGenerators

Best Java code snippets using net.java.quickcheck.generator.CombinedGenerators.uniqueValues (Showing top 3 results out of 315)

origin: lenskit/lenskit

/**
 * Method to compute the data points. Split out so that errors it throws get reported.
 */
@BeforeClass
public static void makeDataPoints() {
  KeyData[] data = new KeyData[10];
  Generator<Long> intGen = longs(Integer.MIN_VALUE, Integer.MAX_VALUE);
  Generator<Long> longGen = longs(Integer.MAX_VALUE + 1L, Long.MAX_VALUE);
  for (int i = 0; i < 10; i++) {
    Generator<List<Long>> listGen;
    if (i % 2 == 0) {
      // generate ints
      listGen = sortedLists(uniqueValues(intGen), 25, 25);
    } else {
      // generate longs
      listGen = sortedLists(uniqueValues(longGen), 25, 25);
    }
    List<Long> nums = listGen.next();
    data[i] = new KeyData(nums);
  }
  DATA_POINTS = data;
}
origin: lenskit/lenskit

  @Test
  public void testAttributeOrder() {
    for (List<String> strings: someNonEmptyLists(uniqueValues(nonEmptyStrings(), 10))) {
      DataSetBuilder bld = new DataSetBuilder(nonEmptyStrings().next());
      StaticDataSource train = new StaticDataSource("train");
      bld.setTrain(train);
      StaticDataSource test = new StaticDataSource("test");
      bld.setTest(test);
      for (String str: strings) {
        bld.setAttribute(str, nonEmptyStrings().next());
      }
      DataSet ds = bld.build();
      assertThat(ds.getAttributes().size(), equalTo(strings.size() + 1));
      List<String> stringArray = new ArrayList<>();
      stringArray.add("DataSet");
      stringArray.addAll(strings);
      String[] strs = stringArray.toArray(new String[stringArray.size()]);
      assertThat(ds.getAttributes().keySet(), contains(strs));
    }
  }
}
origin: net.java.quickcheck/quickcheck

/**
 * <p>
 * Create a generator that ensures unique values.
 * </p>
 * <p>
 * The actual values are created with an arbitrary generator.
 * </p>
 * <p>
 * Unique generator depends on the {@link Comparator} implementation to
 * decide if two instances are the same (i.e. when the comparator returns 0
 * for {@link Comparator#compare(Object, Object)}).
 * </p>
 * 
 * @param <T>
 *            type of values returned by the generator
 * @param generator
 *            used to create the raw values. This generator can create
 *            duplicate values
 * @param comparator
 *            that decides if two values are of the same equivalence class.
 * @return unique generator instance
 */
public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator,
    Comparator<? super T> comparator) {
  return uniqueValues(generator, comparator, DEFAULT_MAX_TRIES);
}
net.java.quickcheck.generatorCombinedGeneratorsuniqueValues

Javadoc

Create a generator that ensures unique values

The actual values are created with an arbitrary generator.

Note: unique generator depends on valid implementation of equals and hashCode method of the content type generated.

Popular methods of CombinedGenerators

  • lists
    Create a generator of lists with values from the content generator. Length values of lists generated
  • nullsAnd
    Create a generator as a combination of a null value generator and generator of type T.
  • sets
    Create a generator of sets with values from the content generator.
  • sortedLists
    Create a generator of sorted lists with values from the content generator. Length is between high an
  • arrays
    Create a generator of arrays with values from the content generator. Length values of arrays generat
  • byteArrays
    Create a generator of byte arrays. Length values of arrays generated will be created with size gener
  • ensureValues
    Create a deterministic generator which guarantees that all values from the ensuredValues array will
  • excludeValues
    Create a generator that omits a given set of values.
  • frequency
    Create a frequency generator. The frequency of Generator usage depends on the generator weight.

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now