RollUpBitMask { public static Set<List<Integer>> getRollUpPermutationsAsPositions(final int tagCount) { final Set<List<Boolean>> resultSet = getRollUpPermutationsAsBooleans(tagCount); final Set<List<Integer>> perms = new HashSet<>(); for (final List<Boolean> perm : resultSet) { perms.add(new ArrayList<>(buildPositionList(perm))); } return perms; } private  RollUpBitMask(final short mask); static RollUpBitMask fromShort(final short maskValue); static RollUpBitMask fromMask(final short[] mask); static RollUpBitMask fromRolledupTagList(final String allTags, final String rolledUpTags); static byte[] byteValueFromTagList(final String allTags, final String rolledUpTags); static int intValueFromTagList(final String allTags, final String rolledUpTags); static RollUpBitMask fromTagPositions(final List<Integer> tagPositions); static RollUpBitMask fromTagPositions(final SortedSet<Integer> tagPositions); static RollUpBitMask fromBytes(final byte[] bytes); static Set<RollUpBitMask> getRollUpBitMasks(final int tagCount); static Set<List<Boolean>> getRollUpPermutationsAsBooleans(final int tagCount); static Set<List<Integer>> getRollUpPermutationsAsPositions(final int tagCount); SortedSet<Integer> getTagPositions(); List<Integer> getTagPositionsAsList(); List<Boolean> getBooleanMask(final int tagCount); boolean isTagPositionRolledUp(final int tagPosition); RollUpBitMask convert(final Map<Integer, Integer> newToOldFieldPositionMap); short asShort(); byte[] asBytes(); String asHexString(); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj); static final short MASK_LENGTH; static final RollUpBitMask ZERO_MASK; static final String ROLL_UP_TAG_VALUE; }
@Test void testGetRollUpPermutationsAsPositionsTagCountZero() { final Set<List<Integer>> perms = RollUpBitMask.getRollUpPermutationsAsPositions(0); assertThat(perms.size()).isEqualTo(1); assertThat(perms.contains(Collections.<Integer>emptyList())).isTrue(); }
@Test void testGetRollUpPermutationsAsPositionsTagCountOne() { final Set<List<Integer>> perms = RollUpBitMask.getRollUpPermutationsAsPositions(1); assertThat(perms.size()).isEqualTo(2); assertThat(perms.contains(Collections.<Integer>emptyList())).isTrue(); assertThat(perms.contains(Arrays.asList(0))).isTrue(); }
@Test void testGetRollUpPermutationsAsPositionsTagCountTwo() { final Set<List<Integer>> perms = RollUpBitMask.getRollUpPermutationsAsPositions(2); assertThat(perms.size()).isEqualTo(4); assertThat(perms.contains(Collections.<Integer>emptyList())).isTrue(); assertThat(perms.contains(Arrays.asList(1))).isTrue(); assertThat(perms.contains(Arrays.asList(0))).isTrue(); assertThat(perms.contains(Arrays.asList(0, 1))).isTrue(); }