Module org.newsclub.net.unix
Package org.newsclub.net.unix
Class NamedIntegerBitmask<T extends NamedIntegerBitmask<T>>
java.lang.Object
org.newsclub.net.unix.NamedIntegerBitmask<T>
- Type Parameters:
- T- The subclass's type itself.
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- AFTIPCGroupRequest.GroupRequestFlags,- AFTIPCTopologySubscription.Flags
@NonNullByDefault
public abstract class NamedIntegerBitmask<T extends NamedIntegerBitmask<T>>
extends Object
implements Serializable
Describes a 32-bit bitmask that supports named flags.
- Author:
- Christian Kohlschütter
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static interfaceNamedIntegerBitmask.Constructor<T extends NamedIntegerBitmask<T>>Creates a new instance.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedNamedIntegerBitmask(@Nullable String name, int flags) Creates a new named flag.
- 
Method SummaryModifier and TypeMethodDescriptionabstract TcombineWith(T other) Combines two flags / flag sets.protected final TcombineWith(T[] allFlags, T flagsNone, NamedIntegerBitmask.Constructor<@NonNull T> constr, T other) Combines two flags / flag sets (use this to implementcombineWith(NamedIntegerBitmask)).final booleanChecks if the given flag is set.final Stringname()Returns the name of the flag / flag set.protected static final <T extends NamedIntegerBitmask<T>>
 Tresolve(T[] allFlags, T flagsNone, NamedIntegerBitmask.Constructor<T> constr, int v) Returns aNamedIntegerBitmaskinstance given a flag value.protected static final <T extends NamedIntegerBitmask<T>>
 Tresolve(T[] allFlags, T flagsNone, NamedIntegerBitmask.Constructor<T> constr, @NonNull T[] setFlags) Returns aNamedIntegerBitmaskinstance given a series of flags.final StringtoString()final intvalue()Returns the value of the flag / flag set.
- 
Constructor Details- 
NamedIntegerBitmaskCreates a new named flag.- Parameters:
- name- The name of the flag / flag set.
- flags- The flag value.
 
 
- 
- 
Method Details- 
name
- 
valuepublic final int value()Returns the value of the flag / flag set.- Returns:
- The value.
 
- 
hasFlagChecks if the given flag is set.- Parameters:
- flag- The flag to check.
- Returns:
- trueiff set.
 
- 
toString
- 
combineWithprotected final T combineWith(T[] allFlags, T flagsNone, NamedIntegerBitmask.Constructor<@NonNull T> constr, T other) Combines two flags / flag sets (use this to implementcombineWith(NamedIntegerBitmask)).- Parameters:
- allFlags- The array of all defined flags, expected "none".
- flagsNone- The "none" flag set.
- constr- The constructor.
- other- The other flag / flag set to merge.
- Returns:
- An instance combining both.
 
- 
combineWith
- 
resolveprotected static final <T extends NamedIntegerBitmask<T>> T resolve(T[] allFlags, T flagsNone, NamedIntegerBitmask.Constructor<T> constr, int v) Returns aNamedIntegerBitmaskinstance given a flag value.- Type Parameters:
- T- The subclass's type itself.
- Parameters:
- allFlags- The array of all defined flags, expected "none".
- flagsNone- The "none" flag set.
- constr- The constructor.
- v- The flag value.
- Returns:
- An instance representing the flag value.
 
- 
resolveprotected static final <T extends NamedIntegerBitmask<T>> T resolve(T[] allFlags, T flagsNone, NamedIntegerBitmask.Constructor<T> constr, @NonNull T[] setFlags) Returns aNamedIntegerBitmaskinstance given a series of flags.- Type Parameters:
- T- The subclass's type itself.
- Parameters:
- allFlags- The array of all defined flags, expected "none".
- flagsNone- The "none" flag set.
- constr- The constructor.
- setFlags- The flags to set, potentially empty.
- Returns:
- An instance representing the flag values.
 
 
-