public void testPermutationSetSize() { assertPermutationsCount(1, Collections2.permutations(Collections.<Integer>emptyList())); assertPermutationsCount(1, Collections2.permutations(newArrayList(1))); assertPermutationsCount(2, Collections2.permutations(newArrayList(1, 2))); assertPermutationsCount(6, Collections2.permutations(newArrayList(1, 2, 3))); assertPermutationsCount(5040, Collections2.permutations(newArrayList(1, 2, 3, 4, 5, 6, 7))); assertPermutationsCount(40320, Collections2.permutations(newArrayList(1, 2, 3, 4, 5, 6, 7, 8))); }
public void testPermutationSetOneElement() { Iterator<List<Integer>> permutations = Collections2.permutations(Collections.<Integer>singletonList(1)).iterator(); assertNextPermutation(newArrayList(1), permutations); assertNoMorePermutations(permutations); }
public void testPermutationSetTwoElements() { Iterator<List<Integer>> permutations = Collections2.permutations(newArrayList(1, 2)).iterator(); assertNextPermutation(newArrayList(1, 2), permutations); assertNextPermutation(newArrayList(2, 1), permutations); assertNoMorePermutations(permutations); }
public void testPermutationSetContains() { List<Integer> list = newArrayList(3, 2, 1); Collection<List<Integer>> permutationSet = Collections2.permutations(list); assertTrue(permutationSet.contains(newArrayList(1, 2, 3))); assertTrue(permutationSet.contains(newArrayList(2, 3, 1))); assertFalse(permutationSet.contains(newArrayList(1, 2))); assertFalse(permutationSet.contains(newArrayList(1, 1, 2, 3))); assertFalse(permutationSet.contains(newArrayList(1, 2, 3, 4))); assertFalse(permutationSet.contains(null)); }
public void testPermutationSetEmpty() { Collection<List<Integer>> permutationSet = Collections2.permutations(Collections.<Integer>emptyList()); assertEquals(1, permutationSet.size()); assertTrue(permutationSet.contains(Collections.<Integer>emptyList())); Iterator<List<Integer>> permutations = permutationSet.iterator(); assertNextPermutation(Collections.<Integer>emptyList(), permutations); assertNoMorePermutations(permutations); }
public void testPermutationSetThreeElements() { Iterator<List<Integer>> permutations = Collections2.permutations(newArrayList(1, 2, 3)).iterator(); assertNextPermutation(newArrayList(1, 2, 3), permutations); assertNextPermutation(newArrayList(1, 3, 2), permutations); assertNextPermutation(newArrayList(3, 1, 2), permutations); assertNextPermutation(newArrayList(3, 2, 1), permutations); assertNextPermutation(newArrayList(2, 3, 1), permutations); assertNextPermutation(newArrayList(2, 1, 3), permutations); assertNoMorePermutations(permutations); }
public void testPermutationSetThreeElementsOutOfOrder() { Iterator<List<Integer>> permutations = Collections2.permutations(newArrayList(3, 2, 1)).iterator(); assertNextPermutation(newArrayList(3, 2, 1), permutations); assertNextPermutation(newArrayList(3, 1, 2), permutations); assertNextPermutation(newArrayList(1, 3, 2), permutations); assertNextPermutation(newArrayList(1, 2, 3), permutations); assertNextPermutation(newArrayList(2, 1, 3), permutations); assertNextPermutation(newArrayList(2, 3, 1), permutations); assertNoMorePermutations(permutations); }
public void testPermutationSetThreeRepeatedElements() { Iterator<List<Integer>> permutations = Collections2.permutations(newArrayList(1, 1, 2)).iterator(); assertNextPermutation(newArrayList(1, 1, 2), permutations); assertNextPermutation(newArrayList(1, 2, 1), permutations); assertNextPermutation(newArrayList(2, 1, 1), permutations); assertNextPermutation(newArrayList(2, 1, 1), permutations); assertNextPermutation(newArrayList(1, 2, 1), permutations); assertNextPermutation(newArrayList(1, 1, 2), permutations); assertNoMorePermutations(permutations); }
public void testPermutationSetSizeOverflow() { // 13 elements overflow an int assertEquals( Integer.MAX_VALUE, Collections2.permutations(newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)).size()); // 21 elements overflow a long assertEquals( Integer.MAX_VALUE, Collections2.orderedPermutations( newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)) .size()); assertEquals( Integer.MAX_VALUE, Collections2.orderedPermutations( newArrayList( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)) .size()); }
public void testRemoveAt_exhaustive() { int size = reduceExponentIfGwt(8); List<Integer> expected = createOrderedList(size); for (Collection<Integer> perm : Collections2.permutations(expected)) { for (int i = 0; i < perm.size(); i++) { MinMaxPriorityQueue<Integer> q = MinMaxPriorityQueue.create(perm); q.removeAt(i); assertIntactUsingStartedWith(perm, q); } } }
public void testPermutationSetFourElements() { Iterator<List<Integer>> permutations = Collections2.permutations(newArrayList(1, 2, 3, 4)).iterator(); assertNextPermutation(newArrayList(1, 2, 3, 4), permutations); assertNextPermutation(newArrayList(1, 2, 4, 3), permutations); assertNextPermutation(newArrayList(1, 4, 2, 3), permutations); assertNextPermutation(newArrayList(4, 1, 2, 3), permutations); assertNextPermutation(newArrayList(4, 1, 3, 2), permutations); assertNextPermutation(newArrayList(1, 4, 3, 2), permutations); assertNextPermutation(newArrayList(1, 3, 4, 2), permutations); assertNextPermutation(newArrayList(1, 3, 2, 4), permutations); assertNextPermutation(newArrayList(3, 1, 2, 4), permutations); assertNextPermutation(newArrayList(3, 1, 4, 2), permutations); assertNextPermutation(newArrayList(3, 4, 1, 2), permutations); assertNextPermutation(newArrayList(4, 3, 1, 2), permutations); assertNextPermutation(newArrayList(4, 3, 2, 1), permutations); assertNextPermutation(newArrayList(3, 4, 2, 1), permutations); assertNextPermutation(newArrayList(3, 2, 4, 1), permutations); assertNextPermutation(newArrayList(3, 2, 1, 4), permutations); assertNextPermutation(newArrayList(2, 3, 1, 4), permutations); assertNextPermutation(newArrayList(2, 3, 4, 1), permutations); assertNextPermutation(newArrayList(2, 4, 3, 1), permutations); assertNextPermutation(newArrayList(4, 2, 3, 1), permutations); assertNextPermutation(newArrayList(4, 2, 1, 3), permutations); assertNextPermutation(newArrayList(2, 4, 1, 3), permutations); assertNextPermutation(newArrayList(2, 1, 4, 3), permutations); assertNextPermutation(newArrayList(2, 1, 3, 4), permutations); assertNoMorePermutations(permutations); }
public void testOfferedKPlusOne() { for (List<Integer> list : Collections2.permutations(Ints.asList(1, 2, 3, 4, 5))) { TopKSelector<Integer> top = TopKSelector.least(4); top.offerAll(list); assertThat(top.topK()).containsExactly(1, 2, 3, 4).inOrder(); } }
public void testOfferedThreeK() { for (List<Integer> list : Collections2.permutations(Ints.asList(1, 2, 3, 4, 5, 6))) { TopKSelector<Integer> top = TopKSelector.least(2); top.offerAll(list); assertThat(top.topK()).containsExactly(1, 2).inOrder(); } }
public void testExhaustive_pollAndPush() { int size = 5; List<Integer> expected = createOrderedList(size); for (Collection<Integer> perm : Collections2.permutations(expected)) { MinMaxPriorityQueue<Integer> q = MinMaxPriorityQueue.create(perm); List<Integer> elements = Lists.newArrayListWithCapacity(size); while (!q.isEmpty()) { Integer next = q.pollFirst(); for (int i = 0; i <= size; i++) { assertTrue(q.add(i)); assertTrue(q.add(next)); assertTrue(q.remove(i)); assertEquals(next, q.poll()); } elements.add(next); } assertEqualsUsingStartedWith(perm, expected, elements); } }
@Test public void testFoldOrder() { final List<String> objects = Lists.newArrayList( "AQcH/xYEMXOjRTVSQ1NXVENEM1RTUlVTRDI1aEVnhkOjNUaCI2MkU2VVhVNkNyVTa4NEYkS0kjZYU1RDdEYzUjglNTUzVFM0NkU3ZFUjOVJCdlU0N2QjRDRUV1MyZjNmVDOUM2RVVFRzhnUzVXY1R1RHUnNziURUdmREM0VjVEQmU0aEInZYNzNZNVRFgzVFNolSJHNIQ3QklEZlNSNoNTJXpDk1dFWjJGNYNiQzQkZFNEYzc1NVhSczM2NmJDZlc3JJRCpVNiRlNEI3dmU1ZGI0Q1RCMhNFZEJDZDYyNFOCM3U0VmRlVlNIRVQ4VVw1djNDVURHVSaFU0VEY0U1JFNIVCYlVEJWM2NWU0eURDOjQ6YyNTYkZjNUVjR1ZDdnVkMzVHZFpjMzlmNEFHM0dHJlRYTHSEQjVZVVZkVVIzIjg2SUU0NSM0VFNDNCdGVlQkhBNENCVTZGZEVlxFQyQ0NYWkUmVUJUYzRlNqg4NVVTNThEJkRGNDNUNFSEYmgkR0dDR1JldCNhVEZGRENGc1NDRUNER3WJRTRHQ4JlOYZoJDVVVVMzZSREZ1Q1UjSHNkdUMlU0ODIzZThSNmNDNjQ1o2I0YiRGYyZkNUJYVEMyN2QpQyMkc2VTE4U2VCNHZF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FUiIoRpVGlXIjY1UVVjc0RDJDNSM0NVJTNkRUU1U0lDdEVXY2NGVVNJVmJJRTREVVNiMyVIQ3U6O0U0M0MzZFVVIzJmNERWJaJjikIlRXk1hFQ2NEU0RUN4UzdENEsVgzZFVidXUnU2VRZFRUQmZmRERCQ0ZER2Q3YnZFNlVpJUkzZVREKFWEUzVVMzYzQzQhfTYzQ0IlI5UoV0RGJCVXSDkyZCRSU3ITUkNoYzJUMkYzhlVVRTNyaDNmQzRDVVRjNkVUhEJyRBR2JlOEREVUU0RjY4Nkc3ZERGUyVDNFZGNFOTY3U1OKNlkjQy1TVlRTQ0M1REU2QhgzUzUzOWlWQ1Z3RTQzIzc7RXVkI0M4NCNYRVRGNEZbhFEyVJI0R1OUZEQ3VUVEQlU1NkNYJEYzdSQ0ZSNGeEWIVVU3KEVFY1RZQ0JSNEJFNFMyM0UzN0hHNTQjMlRGNkiEMyVjRFNVRXNkZGM2M4hENCMnU1VWQjNFRkO2VmO1RndEVzWTQiiHQ0NzM2clM4NjQxpjQjZEVTNEpEdlREJzc3OjZnRlNFNWJVNFeDokNCRmQ5NURJVUZSJyRDRXikVURVITZDNGW0ITNEOUQ0RUklZDQjYjVENURDRCRmRDU1hCY2VTR0RGIzJSZzlSczdTFJJkRlZyU1M1JTdVhDYhVFczQ0hTRIc0RCNDdUJEQxNlZEQ2ZEUiJJRFU3YzVGRER0R2ZlNFOTU1MyRGI0RzMkQ2Q=" ); List<HyperLogLogCollector> collectors = Lists.transform( objects, s -> HyperLogLogCollector.makeCollector(ByteBuffer.wrap(StringUtils.decodeBase64String(s))) ); Collection<List<HyperLogLogCollector>> permutations = Collections2.permutations(collectors); for (List<HyperLogLogCollector> permutation : permutations) { HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); for (HyperLogLogCollector foldee : permutation) { collector.fold(foldee); } Assert.assertEquals(29, collector.getMaxOverflowValue()); Assert.assertEquals(366, collector.getMaxOverflowRegister()); Assert.assertEquals(1.0429189446653817E7, collector.estimateCardinality(), 1); } }
@Test public void shuffle() { // Tries all permutations of item shuffles, with various list sizes. Also randomizes // item values so that the diff must deal with both item updates and movements for (int i = 0; i < 9; i++) { List<EpoxyModel<?>> originalModels = new ArrayList<>(); addModels(i, originalModels); int permutationNumber = 0; for (List<EpoxyModel<?>> permutedModels : Collections2.permutations(originalModels)) { permutationNumber++; // Resetting to the original models each time, otherwise each subsequent permutation is // only a small difference models.clear(); models.addAll(originalModels); diffAndValidate(); models.clear(); models.addAll(permutedModels); changeValues(models); log("\n\n***** Permutation " + permutationNumber + " - List Size: " + i + " ****** \n"); log("old models:\n" + models); log("\n"); log("new models:\n" + models); log("\n"); diffAndValidate(); } } }
/** * Get all possible orderings of fragments */ Set<List<Fragment>> allFragmentOrders() { Collection<List<EquivalentFragmentSet>> fragmentSetPermutations = Collections2.permutations(equivalentFragmentSets); return fragmentSetPermutations.stream().flatMap(ConjunctionQuery::cartesianProduct).collect(toSet()); }
public void testPermutationSetContains() { List<Integer> list = newArrayList(3, 2, 1); Collection<List<Integer>> permutationSet = Collections2.permutations(list); assertTrue(permutationSet.contains(newArrayList(1, 2, 3))); assertTrue(permutationSet.contains(newArrayList(2, 3, 1))); assertFalse(permutationSet.contains(newArrayList(1, 2))); assertFalse(permutationSet.contains(newArrayList(1, 1, 2, 3))); assertFalse(permutationSet.contains(newArrayList(1, 2, 3, 4))); assertFalse(permutationSet.contains(null)); }
public void testPermutationSetThreeRepeatedElements() { Iterator<List<Integer>> permutations = Collections2.permutations( newArrayList(1, 1, 2)).iterator(); assertNextPermutation(newArrayList(1, 1, 2), permutations); assertNextPermutation(newArrayList(1, 2, 1), permutations); assertNextPermutation(newArrayList(2, 1, 1), permutations); assertNextPermutation(newArrayList(2, 1, 1), permutations); assertNextPermutation(newArrayList(1, 2, 1), permutations); assertNextPermutation(newArrayList(1, 1, 2), permutations); assertNoMorePermutations(permutations); }
public void testPermutationSetThreeElementsOutOfOrder() { Iterator<List<Integer>> permutations = Collections2.permutations( newArrayList(3, 2, 1)).iterator(); assertNextPermutation(newArrayList(3, 2, 1), permutations); assertNextPermutation(newArrayList(3, 1, 2), permutations); assertNextPermutation(newArrayList(1, 3, 2), permutations); assertNextPermutation(newArrayList(1, 2, 3), permutations); assertNextPermutation(newArrayList(2, 1, 3), permutations); assertNextPermutation(newArrayList(2, 3, 1), permutations); assertNoMorePermutations(permutations); }