RollUpBitMask { public boolean isTagPositionRolledUp(final int tagPosition) { if (tagPosition < 0) { throw new RuntimeException("Field position cannot be less than zero"); } return getTagPositions().contains(tagPosition); } 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 testIsTagPositionRolledUp() { final List<Integer> tagPositions = Arrays.asList(0, 2, 3); final RollUpBitMask rollUpBitMask = RollUpBitMask.fromTagPositions(tagPositions); for (int i = 0; i <= 5; i++) { if (tagPositions.contains(i)) { assertThat(rollUpBitMask.isTagPositionRolledUp(i)).isTrue(); } else { assertThat(rollUpBitMask.isTagPositionRolledUp(i)).isFalse(); } } }