@Override public String toString() { StringBuilder sb = new StringBuilder("PrivilegeBits: "); if (d.isSimple()) { sb.append(d.longValue()); } else { sb.append(Arrays.toString(d.longValues())); } return sb.toString(); }
@Override public String toString() { StringBuilder sb = new StringBuilder("PrivilegeBits: "); if (d.isSimple()) { sb.append(d.longValue()); } else { sb.append(Arrays.toString(d.longValues())); } return sb.toString(); }
/** * Returns an unmodifiable instance. * * @return an unmodifiable {@code PrivilegeBits} instance. */ @NotNull public PrivilegeBits unmodifiable() { if (d instanceof ModifiableData) { if (d.isSimple()) { return getInstance(d.longValue()); } else { long[] bits = d.longValues(); long[] copy = new long[bits.length]; System.arraycopy(bits, 0, copy, 0, bits.length); return getInstance(copy); } } else { return this; } }
/** * Returns an unmodifiable instance. * * @return an unmodifiable {@code PrivilegeBits} instance. */ @Nonnull public PrivilegeBits unmodifiable() { if (d instanceof ModifiableData) { if (d.isSimple()) { return getInstance(d.longValue()); } else { long[] bits = d.longValues(); long[] copy = new long[bits.length]; System.arraycopy(bits, 0, copy, 0, bits.length); return getInstance(copy); } } else { return this; } }
/** * Add the other Data to this instance. * * @param other */ private void add(Data other) { if (other != this) { if (bits.length == 1 && other.isSimple()) { bits[0] |= other.longValue(); } else { or(other.longValues()); } } }
/** * Add the other Data to this instance. * * @param other */ private void add(Data other) { if (other != this) { if (bits.length == 1 && other.isSimple()) { bits[0] |= other.longValue(); } else { or(other.longValues()); } } }
@Override boolean includes(Data other) { if (bits.length == 1) { return other.isSimple() && includes(bits[0], other.longValue()); } else { return includes(bits, other.longValues()); } }
@Override boolean includes(Data other) { if (isSimple) { return (other.isSimple()) && includes(bits, other.longValue()); } else { return includes(bitsArr, other.longValues()); } }
/** * Subtract the other Data from this instance. * * @param other */ private void diff(Data other) { if (bits.length == 1 && other.isSimple()) { bits[0] = bits[0] & ~other.longValue(); } else { bits = diff(bits, other.longValues()); } }
/** * Subtract the other Data from this instance. * * @param other */ private void diff(Data other) { if (bits.length == 1 && other.isSimple()) { bits[0] = bits[0] & ~other.longValue(); } else { bits = diff(bits, other.longValues()); } }
@Override boolean includes(Data other) { if (bits.length == 1) { return other.isSimple() && includes(bits[0], other.longValue()); } else { return includes(bits, other.longValues()); } }
@Override boolean includes(Data other) { if (isSimple) { return (other.isSimple()) && includes(bits, other.longValue()); } else { return includes(bitsArr, other.longValues()); } }