Package org.apache.calcite.util
Class PartiallyOrderedSetTest
- java.lang.Object
-
- org.apache.calcite.util.PartiallyOrderedSetTest
-
public class PartiallyOrderedSetTest extends java.lang.Object
Unit test forPartiallyOrderedSet
.
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
DEBUG
(package private) java.util.Random
random
private static int
SCALE
(package private) long
seed
(package private) static org.apache.calcite.util.PartiallyOrderedSet.Ordering<java.lang.String>
STRING_SUBSET_ORDERING
-
Constructor Summary
Constructors Constructor Description PartiallyOrderedSetTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
assertEqualsList(java.lang.String expected, java.util.List<java.lang.String> ss)
void
checkPoset(org.apache.calcite.util.PartiallyOrderedSet.Ordering<java.lang.Integer> ordering, boolean debug, java.lang.Iterable<java.lang.Integer> generator, boolean remove)
(package private) void
checkPosetBitsLarge(org.apache.calcite.util.PartiallyOrderedSet<java.lang.Integer> poset, int n, int expectedSize, int expectedParentCount)
private <E> void
dump(org.apache.calcite.util.PartiallyOrderedSet<E> poset)
private static boolean
isBitSubset(int e1, int e2)
As an ordering, integers are ordered by bit inclusion.private static boolean
isBitSuperset(java.lang.Integer e1, java.lang.Integer e2)
As an ordering, integers are ordered by bit inclusion.private static boolean
isDivisor(int e1, int e2)
As an ordering, integers are ordered by division.private static boolean
isDivisorInverse(java.lang.Integer e1, java.lang.Integer e2)
As an ordering, bottom is 1, parents are primes, etc.private <E> void
printValidate(org.apache.calcite.util.PartiallyOrderedSet<E> poset)
private static java.lang.Iterable<java.lang.Integer>
random(java.util.Random random, int size, int max)
private static java.util.Collection<java.lang.Integer>
range(int start, int end)
void
testDivisorInverseRandom()
void
testDivisorInverseRandomWithRemoval()
void
testDivisorInverseSeries()
void
testDivisorPoset()
void
testDivisorRandom()
void
testDivisorRandomWithRemoval()
void
testDivisorSeries()
void
testPoset()
void
testPosetBits()
void
testPosetBitsLarge()
void
testPosetBitsLarge2()
void
testPosetBitsRemoveParent()
void
testPosetTricky()
void
testSubsetRandom()
void
testSubsetSeries()
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
SCALE
private static final int SCALE
-
seed
final long seed
-
random
final java.util.Random random
-
STRING_SUBSET_ORDERING
static final org.apache.calcite.util.PartiallyOrderedSet.Ordering<java.lang.String> STRING_SUBSET_ORDERING
-
-
Method Detail
-
isDivisor
private static boolean isDivisor(int e1, int e2)
As an ordering, integers are ordered by division. Top is 1, its children are primes, etc.
-
isDivisorInverse
private static boolean isDivisorInverse(java.lang.Integer e1, java.lang.Integer e2)
As an ordering, bottom is 1, parents are primes, etc.
-
isBitSubset
private static boolean isBitSubset(int e1, int e2)
As an ordering, integers are ordered by bit inclusion. E.g. the children of 14 (1110) are 12 (1100), 10 (1010) and 6 (0110).
-
isBitSuperset
private static boolean isBitSuperset(java.lang.Integer e1, java.lang.Integer e2)
As an ordering, integers are ordered by bit inclusion. E.g. the parents of 14 (1110) are 12 (1100), 10 (1010) and 6 (0110).
-
testPoset
public void testPoset()
-
testPosetTricky
public void testPosetTricky()
-
testPosetBits
public void testPosetBits()
-
testPosetBitsLarge
public void testPosetBitsLarge()
-
testPosetBitsLarge2
public void testPosetBitsLarge2()
-
checkPosetBitsLarge
void checkPosetBitsLarge(org.apache.calcite.util.PartiallyOrderedSet<java.lang.Integer> poset, int n, int expectedSize, int expectedParentCount)
-
testPosetBitsRemoveParent
public void testPosetBitsRemoveParent()
-
testDivisorPoset
public void testDivisorPoset()
-
testDivisorSeries
public void testDivisorSeries()
-
testDivisorRandom
public void testDivisorRandom()
-
testDivisorRandomWithRemoval
public void testDivisorRandomWithRemoval()
-
testDivisorInverseSeries
public void testDivisorInverseSeries()
-
testDivisorInverseRandom
public void testDivisorInverseRandom()
-
testDivisorInverseRandomWithRemoval
public void testDivisorInverseRandomWithRemoval()
-
testSubsetSeries
public void testSubsetSeries()
-
testSubsetRandom
public void testSubsetRandom()
-
printValidate
private <E> void printValidate(org.apache.calcite.util.PartiallyOrderedSet<E> poset)
-
checkPoset
public void checkPoset(org.apache.calcite.util.PartiallyOrderedSet.Ordering<java.lang.Integer> ordering, boolean debug, java.lang.Iterable<java.lang.Integer> generator, boolean remove)
-
dump
private <E> void dump(org.apache.calcite.util.PartiallyOrderedSet<E> poset)
-
range
private static java.util.Collection<java.lang.Integer> range(int start, int end)
-
random
private static java.lang.Iterable<java.lang.Integer> random(java.util.Random random, int size, int max)
-
assertEqualsList
private static void assertEqualsList(java.lang.String expected, java.util.List<java.lang.String> ss)
-
-