Class IntentSet
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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic IntentSetall()Returns aIntentSetcontaining all intents.Performs a logical AND of this intent set with the other intent set.Performs a logical AND NOT of this intent set with the other intent set.Gets thisIntentSetas anEnumSet.booleanbooleanlongGets the raw value for thisIntentSet.inthashCode()iterator()static IntentSetnone()Returns aIntentSetcontaining no intents.static IntentSetReturns aIntentSetcontaining non-privileged intents.not()Performs a logical NOT of this intent set.static IntentSetof(long rawValue) Returns aIntentSetcontaining all the intents represented by the raw value.static IntentSetReturns aIntentSetcontaining all the supplied intents.Performs a logical OR of this intent set with the other intent set.intsize()toString()Performs a logical XOR of this intent set with the other intent set.Methods inherited from class java.util.AbstractSet
removeAllMethods inherited from class java.util.AbstractCollection
add, addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Method Details
-
all
Returns aIntentSetcontaining all intents.- Returns:
- A
IntentSetcontaining all intents.
-
none
Returns aIntentSetcontaining no intents.- Returns:
- A
IntentSetcontaining no intents.
-
nonPrivileged
Returns aIntentSetcontaining non-privileged intents.- Returns:
- A
IntentSetcontaining non-privileged intents. - See Also:
-
of
Returns aIntentSetcontaining all the intents represented by the raw value.- Parameters:
rawValue- A bit-wise OR evaluation of multiple values returned byIntent.getValue().- Returns:
- A
IntentSetcontaining all the intents represented by the raw value.
-
of
Returns aIntentSetcontaining all the supplied intents.- Parameters:
intents- The intents to add to theIntentSet.- Returns:
- A
IntentSetcontaining all the supplied intents.
-
and
Performs a logical AND of this intent set with the other intent set.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)- Parameters:
other- The other intent set.- Returns:
- The intersection of this set with the other set.
-
or
Performs a logical OR of this intent set with the other intent set.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)- Parameters:
other- The other intent set.- Returns:
- The union of this set with the other set.
-
xor
Performs a logical XOR of this intent set with the other intent set.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)- Parameters:
other- The other intent set.- Returns:
- The symmetric difference of this set with the other set.
-
andNot
Performs a logical AND NOT of this intent set with the other intent set.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)- Parameters:
other- The other intent set.- Returns:
- The relative complement of this set with the other set.
-
not
Performs a logical NOT of this intent set.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()- Returns:
- The complement of this set.
-
asEnumSet
Gets thisIntentSetas anEnumSet.- Returns:
- This
IntentSetas anEnumSet.
-
getRawValue
public long getRawValue()Gets the raw value for thisIntentSet.- Returns:
- The raw value for this
IntentSet. - See Also:
-
contains
- Specified by:
containsin interfaceCollection<Intent>- Specified by:
containsin interfaceSet<Intent>- Overrides:
containsin classAbstractCollection<Intent>
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<Intent>- Specified by:
sizein interfaceSet<Intent>- Specified by:
sizein classAbstractCollection<Intent>
-
equals
- Specified by:
equalsin interfaceCollection<Intent>- Specified by:
equalsin interfaceSet<Intent>- Overrides:
equalsin classAbstractSet<Intent>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<Intent>- Specified by:
hashCodein interfaceSet<Intent>- Overrides:
hashCodein classAbstractSet<Intent>
-
toString
- Overrides:
toStringin classAbstractCollection<Intent>
-