public final class IntentSet extends AbstractSet<Intent>
Set<Intent>
.
This is a value-based
class; use of identity-sensitive operations (including reference equality
(==
), identity hash code, or synchronization) on instances of
IntentSet
may have unpredictable results and should be avoided.
The equals
method should be used for comparisons.
Modifier and Type | Method and Description |
---|---|
static IntentSet |
all()
Returns a
IntentSet containing all intents. |
IntentSet |
and(IntentSet other)
Performs a logical AND of this intent set with the other intent set.
|
IntentSet |
andNot(IntentSet other)
Performs a logical AND NOT of this intent set with the other intent set.
|
EnumSet<Intent> |
asEnumSet()
Gets this
IntentSet as an EnumSet . |
boolean |
contains(Object o) |
boolean |
equals(Object o) |
long |
getRawValue()
Gets the raw value for this
IntentSet . |
int |
hashCode() |
Iterator<Intent> |
iterator() |
static IntentSet |
none()
Returns a
IntentSet containing no intents. |
IntentSet |
not()
Performs a logical NOT of this intent set.
|
static IntentSet |
of(Intent... intents)
Returns a
IntentSet containing all the supplied intents. |
static IntentSet |
of(long rawValue)
Returns a
IntentSet containing all the intents represented by the raw value. |
IntentSet |
or(IntentSet other)
Performs a logical OR of this intent set with the other intent set.
|
int |
size() |
String |
toString() |
IntentSet |
xor(IntentSet other)
Performs a logical XOR of this intent set with the other intent set.
|
removeAll
add, addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, clear, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public static IntentSet all()
IntentSet
containing all intents.IntentSet
containing all intents.public static IntentSet none()
IntentSet
containing no intents.IntentSet
containing no intents.public static IntentSet of(long rawValue)
IntentSet
containing all the intents represented by the raw value.rawValue
- A bit-wise OR evaluation of multiple values returned by Intent.getValue()
.IntentSet
containing all the intents represented by the raw value.public static IntentSet of(Intent... intents)
IntentSet
containing all the supplied intents.intents
- The intents to add to the IntentSet
.IntentSet
containing all the supplied intents.public IntentSet and(IntentSet other)
The resultant set is the intersection of this set and the other set. A intent is contained if and only
if it was
contained in both this set and the other set. This is analogous to Set.retainAll(java.util.Collection)
.
IntentSet set0 = IntentSet.of(GUILDS, GUILD_MEMBERS);
IntentSet set1 = IntentSet.of(GUILDS);
set0.and(set1) = IntentSet.of(GUILDS)
other
- The other intent set.public IntentSet or(IntentSet other)
The resultant set is the union of this set and the other set. A intent is contained if and only if it
was contained in either this set or the other set. This is analogous to Set.addAll(java.util.Collection)
.
IntentSet set0 = IntentSet.of(GUILDS);
IntentSet set1 = IntentSet.of(GUILD_MEMBERS);
set0.or(set1) = IntentSet.of(GUILDS, GUILD_MEMBERS)
other
- The other intent set.public IntentSet xor(IntentSet other)
The resultant set is the symmetric difference of this set and the other set. A intent is contained if and only if it was contained in only this set or contained in only the other set.
IntentSet set0 = IntentSet.of(GUILDS, GUILD_MEMBERS, GUILD_BANS);
IntentSet set1 = IntentSet.of(GUILD_BANS, GUILD_EMOJIS);
set0.xor(set1) = IntentSet.of(GUILDS, GUILD_MEMBERS, GUILD_EMOJIS)
other
- The other intent set.public IntentSet andNot(IntentSet other)
The resultant set is the relative complement of this set and the other set. A intent is contained if
and only if it was contained in this set and not contained in the other set. This is analogous to
Set.removeAll(java.util.Collection)
.
IntentSet set0 = IntentSet.of(GUILDS, GUILD_MEMBERS, GUILD_BANS);
IntentSet set1 = IntentSet.of(GUILD_MEMBERS, GUILD_BANS, GUILD_EMOJIS);
set0.andNot(set1) = IntentSet.of(GUILDS)
other
- The other intent set.public IntentSet not()
The resultant set is the complement of this set. A intent is contained if and only if it was not contained in this set.
IntentSet set = IntentSet.none();
set.not() = IntentSet.all()
public EnumSet<Intent> asEnumSet()
IntentSet
as an EnumSet
.IntentSet
as an EnumSet
.public long getRawValue()
IntentSet
.IntentSet
.IntentSet
public boolean contains(Object o)
contains
in interface Collection<Intent>
contains
in interface Set<Intent>
contains
in class AbstractCollection<Intent>
public int size()
size
in interface Collection<Intent>
size
in interface Set<Intent>
size
in class AbstractCollection<Intent>
public boolean equals(Object o)
equals
in interface Collection<Intent>
equals
in interface Set<Intent>
equals
in class AbstractSet<Intent>
public int hashCode()
hashCode
in interface Collection<Intent>
hashCode
in interface Set<Intent>
hashCode
in class AbstractSet<Intent>
public String toString()
toString
in class AbstractCollection<Intent>