/** * Retains the elements in this {@code PrivilegeBits} that are contained in * the specified other {@code PrivilegeBits}. * * @param other Other privilege bits. * @return This modifiable instance of privilege bits modified such it contains * only privileges that were also contained in the {@code other} instance. */ @Nonnull public PrivilegeBits retain(@Nonnull PrivilegeBits other) { if (d instanceof ModifiableData) { ((ModifiableData) d).retain(other.d); return this; } else { throw unsupported(); } }
/** * Subtracts the other PrivilegeBits from the this.<br> * If the specified bits do not intersect with this, it isn't modified.<br> * If {@code this} is included in {@code other} {@link #EMPTY empty} * privilege bits is returned. * * @param other The other privilege bits to be subtracted from this instance. * @return The updated instance. * @throws UnsupportedOperationException if this instance is immutable. */ @NotNull public PrivilegeBits diff(@NotNull PrivilegeBits other) { if (d instanceof ModifiableData) { ((ModifiableData) d).diff(other.d); return this; } else { throw unsupported(); } }
/** * Retains the elements in this {@code PrivilegeBits} that are contained in * the specified other {@code PrivilegeBits}. * * @param other Other privilege bits. * @return This modifiable instance of privilege bits modified such it contains * only privileges that were also contained in the {@code other} instance. */ @NotNull public PrivilegeBits retain(@NotNull PrivilegeBits other) { if (d instanceof ModifiableData) { ((ModifiableData) d).retain(other.d); return this; } else { throw unsupported(); } }
/** * Subtracts the other PrivilegeBits from the this.<br> * If the specified bits do not intersect with this, it isn't modified.<br> * If {@code this} is included in {@code other} {@link #EMPTY empty} * privilege bits is returned. * * @param other The other privilege bits to be subtracted from this instance. * @return The updated instance. * @throws UnsupportedOperationException if this instance is immutable. */ @Nonnull public PrivilegeBits diff(@Nonnull PrivilegeBits other) { if (d instanceof ModifiableData) { ((ModifiableData) d).diff(other.d); return this; } else { throw unsupported(); } }
/** * Subtracts the {@code b} from {@code a} and adds the result (diff) * to this instance. * * @param a An instance of privilege bits. * @param b An instance of privilege bits. * @return The updated instance. * @throws UnsupportedOperationException if this instance is immutable. */ @Nonnull public PrivilegeBits addDifference(@Nonnull PrivilegeBits a, @Nonnull PrivilegeBits b) { if (d instanceof ModifiableData) { ((ModifiableData) d).addDifference(a.d, b.d); return this; } else { throw unsupported(); } }
/** * Subtracts the {@code b} from {@code a} and adds the result (diff) * to this instance. * * @param a An instance of privilege bits. * @param b An instance of privilege bits. * @return The updated instance. * @throws UnsupportedOperationException if this instance is immutable. */ @NotNull public PrivilegeBits addDifference(@NotNull PrivilegeBits a, @NotNull PrivilegeBits b) { if (d instanceof ModifiableData) { ((ModifiableData) d).addDifference(a.d, b.d); return this; } else { throw unsupported(); } }
/** * Adds the other privilege bits to this instance. * * @param other The other privilege bits to be added. * @return The updated instance. * @throws UnsupportedOperationException if this instance is immutable. */ @NotNull public PrivilegeBits add(@NotNull PrivilegeBits other) { if (d instanceof ModifiableData) { ((ModifiableData) d).add(other.d); return this; } else { throw unsupported(); } }
/** * Adds the other privilege bits to this instance. * * @param other The other privilege bits to be added. * @return The updated instance. * @throws UnsupportedOperationException if this instance is immutable. */ @Nonnull public PrivilegeBits add(@Nonnull PrivilegeBits other) { if (d instanceof ModifiableData) { ((ModifiableData) d).add(other.d); return this; } else { throw unsupported(); } }