|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<E>
com.threerings.util.StreamableEnumSet<E>
E - the type of enum being stored in this set.public class StreamableEnumSet<E extends Enum<E>>
An EnumSet equivalent (not a subclass, because EnumSet's implementation is private)
that can be streamed.
Streamable| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
Streamable.Closure |
| Field Summary | |
|---|---|
protected byte[] |
_contents
A byte array with bits set for each element in the set. |
protected Class<E> |
_elementType
The element type. |
protected int |
_modcount
The modification count (used to detect concurrent modifications). |
protected int |
_size
The number of elements in the set. |
| Constructor Summary | |
|---|---|
StreamableEnumSet(Class<E> elementType)
Creates a new, empty enum set for storing elements of the specified class. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(E o)
|
|
static
|
allOf(Class<E> elementType)
Creates a set containing all elements of the specified type. |
|
protected boolean |
classDefinesElementType()
Subclasses that only store elements of a single enum type (initialized in their no-arg constructors) can return true here to avoid the overhead of streaming the
enum type for each instance. |
|
void |
clear()
|
|
StreamableEnumSet<E> |
clone()
|
|
static
|
complementOf(StreamableEnumSet<E> s)
Creates a set containing all elements not in the set provided. |
|
boolean |
contains(Object o)
|
|
static
|
copyOf(Collection<E> s)
Creates a set containing all elements in the collection provided (which must have at least one element, unless it is a StreamableEnumSet). |
|
static
|
copyOf(StreamableEnumSet<E> s)
Creates a set containing all elements in the set provided. |
|
protected void |
initContents()
Creates the contents array. |
|
Iterator<E> |
iterator()
|
|
static
|
noneOf(Class<E> elementType)
Creates an empty set of the specified type. |
|
static
|
of(E first,
E... rest)
Creates a set consisting of the specified elements. |
|
static
|
range(E from,
E to)
Creates a set that includes all enum constants in the specified (inclusive) range. |
|
void |
readObject(ObjectInputStream in)
Reads our custom streamable fields. |
|
boolean |
remove(Object o)
|
|
int |
size()
|
|
void |
writeObject(ObjectOutputStream out)
Writes our custom streamable fields. |
|
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
addAll, containsAll, isEmpty, retainAll, toArray, toArray |
| Field Detail |
|---|
protected Class<E extends Enum<E>> _elementType
protected byte[] _contents
protected int _size
protected int _modcount
| Constructor Detail |
|---|
public StreamableEnumSet(Class<E> elementType)
| Method Detail |
|---|
public static <E extends Enum<E>> StreamableEnumSet<E> noneOf(Class<E> elementType)
public static <E extends Enum<E>> StreamableEnumSet<E> allOf(Class<E> elementType)
public static <E extends Enum<E>> StreamableEnumSet<E> copyOf(Collection<E> s)
StreamableEnumSet).
public static <E extends Enum<E>> StreamableEnumSet<E> copyOf(StreamableEnumSet<E> s)
public static <E extends Enum<E>> StreamableEnumSet<E> complementOf(StreamableEnumSet<E> s)
public static <E extends Enum<E>> StreamableEnumSet<E> of(E first,
E... rest)
public static <E extends Enum<E>> StreamableEnumSet<E> range(E from,
E to)
public Iterator<E> iterator()
iterator in interface Iterable<E extends Enum<E>>iterator in interface Collection<E extends Enum<E>>iterator in interface Set<E extends Enum<E>>iterator in class AbstractCollection<E extends Enum<E>>public int size()
size in interface Collection<E extends Enum<E>>size in interface Set<E extends Enum<E>>size in class AbstractCollection<E extends Enum<E>>public boolean contains(Object o)
contains in interface Collection<E extends Enum<E>>contains in interface Set<E extends Enum<E>>contains in class AbstractCollection<E extends Enum<E>>public boolean add(E o)
add in interface Collection<E extends Enum<E>>add in interface Set<E extends Enum<E>>add in class AbstractCollection<E extends Enum<E>>public boolean remove(Object o)
remove in interface Collection<E extends Enum<E>>remove in interface Set<E extends Enum<E>>remove in class AbstractCollection<E extends Enum<E>>public void clear()
clear in interface Collection<E extends Enum<E>>clear in interface Set<E extends Enum<E>>clear in class AbstractCollection<E extends Enum<E>>public StreamableEnumSet<E> clone()
clone in class Object
public void writeObject(ObjectOutputStream out)
throws IOException
IOException
public void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundExceptionprotected boolean classDefinesElementType()
true here to avoid the overhead of streaming the
enum type for each instance.
protected void initContents()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||