java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>, java.util.SortedSet<E>public abstract class Flags<E extends java.lang.Enum<E>,This extends Flags<E,This>>
extends java.util.AbstractSet<E>
implements java.util.SortedSet<E>
| Modifier | Constructor | Description |
|---|---|---|
protected |
Flags(int bits) |
Construct a new instance.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract E |
castItemOrNull(java.lang.Object obj) |
Get the item (cast to the correct
enum type), or null if it is not of the correct type. |
protected abstract This |
castThis(java.lang.Object obj) |
Cast the given object to this class, throwing an exception if the cast fails.
|
java.util.Comparator<? super E> |
comparator() |
Get the
null comparator, indicating that this set is always sorted in natural order. |
This |
complement() |
Get the complement of this set.
|
boolean |
contains(E flag) |
Determine if this flag set contains the given flag.
|
boolean |
contains(java.lang.Object o) |
Determine if this flag set contains the given object.
|
boolean |
containsAll(E flag1,
E flag2) |
Determine if this flag set contains all of the given flags.
|
boolean |
containsAll(E flag1,
E flag2,
E flag3) |
Determine if this flag set contains all of the given flags.
|
boolean |
containsAll(java.util.Collection<?> c) |
Determine if this flag set contains all of the objects in the given collection.
|
boolean |
containsAll(This other) |
Determine if this flag set contains all of the flags in the given flag set.
|
boolean |
containsAny(E flag1,
E flag2) |
Determine if this flag set contains any of the given flags.
|
boolean |
containsAny(E flag1,
E flag2,
E flag3) |
Determine if this flag set contains any of the given flags.
|
boolean |
containsAny(This other) |
Determine if this flag set contains any of the flags in the given flag set.
|
java.util.Iterator<E> |
descendingIterator() |
Iterate this set in order from last to first flag.
|
boolean |
equals(java.lang.Object o) |
Determine if this flag set is equal to the given object.
|
boolean |
equals(java.util.Set<?> o) |
Determine if this flag set is equal to the given set.
|
boolean |
equals(This o) |
Determine if this flag set is equal to the given flag set.
|
E |
first() |
Get the first flag in the set.
|
void |
forEach(java.util.function.Consumer<? super E> action) |
Apply the given action for every flag in this set.
|
int |
hashCode() |
Get the hash code of this flag set.
|
This |
headSet(E toElement) |
Get the subset of flags from this set, up to (but not including) the given element.
|
boolean |
isEmpty() |
Determine if this flag set is empty.
|
protected abstract E |
itemOf(int index) |
Get the flag item with the given index.
|
java.util.Iterator<E> |
iterator() |
Iterate this set in order from first to last flag.
|
E |
last() |
Get the last flag in the set.
|
int |
size() |
Get the size of the flag set.
|
This |
subSet(E fromElement,
E toElement) |
Get the subset of flags, starting from
fromElement up to (but not including) toElement. |
This |
tailSet(E fromElement) |
Get the subset of flags from this set, starting from the given element.
|
protected abstract This |
this_() |
Return
this. |
java.lang.Object[] |
toArray() |
Get an
Object array containing all the flag values of this set. |
<T> T[] |
toArray(T[] array) |
Get a typed array containing all the flag values of this set.
|
java.lang.String |
toString() |
Get a string representation of this flag set.
|
protected abstract This |
value(int bits) |
Get the set value of the given bit combination.
|
This |
with(E flag) |
Return a set which includes all of the flags in this set and the given additional flag.
|
This |
with(E... flags) |
Return a set which includes all of the flags in this set and the given additional flags.
|
This |
with(E flag1,
E flag2) |
Return a set which includes all of the flags in this set and the given additional flags.
|
This |
with(E flag1,
E flag2,
E flag3) |
Return a set which includes all of the flags in this set and the given additional flags.
|
This |
with(This other) |
Return a set which includes all of the flags in this set and the given additional flags.
|
This |
without(E flag) |
Return a set which includes all of the flags except for the given flag.
|
This |
without(This other) |
Return a set which includes all of the flags except for the given flags.
|
protected Flags(int bits)
bits - the bits of this setprotected abstract This value(int bits)
bits - the bit combination (possibly with extra bits)protected abstract This this_()
this.thisprotected abstract E itemOf(int index)
index - the indexprotected abstract E castItemOrNull(java.lang.Object obj)
enum type), or null if it is not of the correct type.obj - the object to castnullprotected abstract This castThis(java.lang.Object obj)
obj - the object to castpublic final int size()
public final E first()
public final E last()
public final java.util.Comparator<? super E> comparator()
null comparator, indicating that this set is always sorted in natural order.public boolean isEmpty()
isEmpty in interface java.util.Collection<E extends java.lang.Enum<E>>isEmpty in interface java.util.Set<E extends java.lang.Enum<E>>isEmpty in class java.util.AbstractCollection<E extends java.lang.Enum<E>>true if the flag set is empty, false otherwisepublic final This headSet(E toElement)
public final This tailSet(E fromElement)
public final This subSet(E fromElement, E toElement)
fromElement up to (but not including) toElement.public final java.lang.Object[] toArray()
Object array containing all the flag values of this set.public final <T> T[] toArray(T[] array)
toArray in interface java.util.Collection<E extends java.lang.Enum<E>>toArray in interface java.util.Set<E extends java.lang.Enum<E>>toArray in class java.util.AbstractCollection<E extends java.lang.Enum<E>>T - the element typearray - the array to populate or clonepublic final boolean contains(E flag)
flag - the flagtrue if the flag is contained by this setpublic final boolean contains(java.lang.Object o)
contains in interface java.util.Collection<E extends java.lang.Enum<E>>contains in interface java.util.Set<E extends java.lang.Enum<E>>contains in class java.util.AbstractCollection<E extends java.lang.Enum<E>>o - the objecttrue if the object is contained by this setpublic final boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<E extends java.lang.Enum<E>>containsAll in interface java.util.Set<E extends java.lang.Enum<E>>containsAll in class java.util.AbstractCollection<E extends java.lang.Enum<E>>c - the collectiontrue if all of the collection's objects are contained by this setpublic final boolean containsAll(This other)
other - the flag settrue if all of the given set's flags are contained by this setpublic final boolean containsAll(E flag1, E flag2)
flag1 - the first flagflag2 - the second flagtrue if all of the given flags are contained by this setpublic final boolean containsAll(E flag1, E flag2, E flag3)
flag1 - the first flagflag2 - the second flagflag3 - the third flagtrue if all of the given flags are contained by this setpublic final boolean containsAny(This other)
other - the flag settrue if all of the given set's flags are contained by this setpublic final boolean containsAny(E flag1, E flag2)
flag1 - the first flagflag2 - the second flagtrue if any of the given flags are contained by this setpublic final boolean containsAny(E flag1, E flag2, E flag3)
flag1 - the first flagflag2 - the second flagflag3 - the third flagtrue if any of the given flags are contained by this setpublic final This complement()
public final This with(E flag)
flag - the additional flagpublic final This with(E flag1, E flag2)
flag1 - the first flagflag2 - the second flagpublic final This with(E flag1, E flag2, E flag3)
flag1 - the first flagflag2 - the second flagflag3 - the third flag@SafeVarargs public final This with(E... flags)
flags - the additional flagspublic final This with(This other)
other - the additional flagspublic final This without(E flag)
flag - the flagpublic final This without(This other)
other - the flagspublic final boolean equals(java.lang.Object o)
equals in interface java.util.Collection<E extends java.lang.Enum<E>>equals in interface java.util.Set<E extends java.lang.Enum<E>>equals in class java.util.AbstractSet<E extends java.lang.Enum<E>>o - the other objecttrue if the object is equal to this set, false otherwisepublic final boolean equals(java.util.Set<?> o)
o - the other settrue if the set is equal to this set, false otherwisepublic final boolean equals(This o)
o - the other flag settrue if the flag set is equal to this set, false otherwisepublic final int hashCode()
public final java.util.Iterator<E> iterator()
iterator in interface java.util.Collection<E extends java.lang.Enum<E>>iterator in interface java.lang.Iterable<E extends java.lang.Enum<E>>iterator in interface java.util.Set<E extends java.lang.Enum<E>>iterator in class java.util.AbstractCollection<E extends java.lang.Enum<E>>public final java.util.Iterator<E> descendingIterator()
public void forEach(java.util.function.Consumer<? super E> action)
Copyright © 2018 JBoss, a division of Red Hat, Inc.