@Test public void asEnumSetShouldReturnCorrectEnumSetWhenFlag1Set() { final Byte bitmask = 1; final BitmaskMeasurementElement element = new BitmaskMeasurementElement(bitmask); final EnumSet<BitmaskFlag> expected = EnumSet.noneOf(BitmaskFlag.class); expected.add(BitmaskFlag.FLAG_1); final Set<BitmaskFlag> actual = element.asEnumSet(); assertThat(actual).isEqualTo(expected); }
public Set<BitmaskFlag> asEnumSet() { final Set<BitmaskFlag> bitmaskFlags = EnumSet.noneOf(BitmaskFlag.class); for (final BitmaskFlag flag : BitmaskFlag.values()) { if ((this.value & flag.value) > 0) { bitmaskFlags.add(flag); } } return bitmaskFlags; }
BitmaskMeasurementElement implements MeasurementElement, Serializable { public Set<BitmaskFlag> asEnumSet() { final Set<BitmaskFlag> bitmaskFlags = EnumSet.noneOf(BitmaskFlag.class); for (final BitmaskFlag flag : BitmaskFlag.values()) { if ((this.value & flag.value) > 0) { bitmaskFlags.add(flag); } } return bitmaskFlags; } }
BitmaskMeasurementElement implements MeasurementElement, Serializable { public Set<BitmaskFlag> asEnumSet() { final Set<BitmaskFlag> bitmaskFlags = EnumSet.noneOf(BitmaskFlag.class); for (final BitmaskFlag flag : BitmaskFlag.values()) { if ((this.value & flag.value) > 0) { bitmaskFlags.add(flag); } } return bitmaskFlags; } BitmaskMeasurementElement(final Byte value); }
BitmaskMeasurementElement implements MeasurementElement, Serializable { public Set<BitmaskFlag> asEnumSet() { final Set<BitmaskFlag> bitmaskFlags = EnumSet.noneOf(BitmaskFlag.class); for (final BitmaskFlag flag : BitmaskFlag.values()) { if ((this.value & flag.value) > 0) { bitmaskFlags.add(flag); } } return bitmaskFlags; } BitmaskMeasurementElement(final Byte value); Byte getValue(); boolean getFlag(final BitmaskFlag flag); Set<BitmaskFlag> asEnumSet(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); }
BitmaskMeasurementElement implements MeasurementElement, Serializable { public Set<BitmaskFlag> asEnumSet() { final Set<BitmaskFlag> bitmaskFlags = EnumSet.noneOf(BitmaskFlag.class); for (final BitmaskFlag flag : BitmaskFlag.values()) { if ((this.value & flag.value) > 0) { bitmaskFlags.add(flag); } } return bitmaskFlags; } BitmaskMeasurementElement(final Byte value); Byte getValue(); boolean getFlag(final BitmaskFlag flag); Set<BitmaskFlag> asEnumSet(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }