Enum Constant and Description |
---|
BIASED
Returns a randomly chosen object.
|
FREE
Returns a free object or
null if all the objects are in use. |
RANDOM
Returns a randomly chosen free or used object.
|
READ
Returns an object being read or
null if there are no such objects. |
TRY_FREE
Returns a free object (if available) or a used one (otherwise).
|
TRY_READ
Returns an object being read (if available) or a random one (otherwise).
|
TRY_USED
Returns a used object (if available) or a random one (otherwise).
|
TRY_WRITE
Returns an object being written (if available) or a random one (otherwise).
|
USED
Returns a used object or
null there are no such objects. |
WRITE
Returns an object being written or
null if there are no such objects. |
Modifier and Type | Method and Description |
---|---|
abstract <T> T |
next(java.util.Collection<T> retain,
java.util.Collection<T> exclude,
java.util.Map<ResourceOperation,java.util.Collection<T>> used,
java.util.Map<ResourceOperation,java.lang.Integer> rate)
Chooses an object.
|
abstract <T> T |
next(Supplier<T> supplier,
java.util.Collection<T> exclude,
java.util.Map<ResourceOperation,java.util.Collection<T>> used,
java.util.Map<ResourceOperation,java.lang.Integer> rate)
Generates an object.
|
static Allocator |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Allocator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Allocator RANDOM
public static final Allocator FREE
null
if all the objects are in use.public static final Allocator USED
null
there are no such objects.public static final Allocator READ
null
if there are no such objects.public static final Allocator WRITE
null
if there are no such objects.public static final Allocator TRY_FREE
public static final Allocator TRY_USED
public static final Allocator TRY_READ
public static final Allocator TRY_WRITE
public static final Allocator BIASED
public static Allocator[] values()
for (Allocator c : Allocator.values()) System.out.println(c);
public static Allocator valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic abstract <T> T next(java.util.Collection<T> retain, java.util.Collection<T> exclude, java.util.Map<ResourceOperation,java.util.Collection<T>> used, java.util.Map<ResourceOperation,java.lang.Integer> rate)
T
- type of objects.retain
- the set of all available objects.exclude
- the set of objects to be excluded.used
- the of used objects.rate
- the dependencies biases.null
.public abstract <T> T next(Supplier<T> supplier, java.util.Collection<T> exclude, java.util.Map<ResourceOperation,java.util.Collection<T>> used, java.util.Map<ResourceOperation,java.lang.Integer> rate)
T
- type of objects.supplier
- the object generator.exclude
- the set of objects to be excluded.used
- the set of used objects.rate
- the dependencies biases.null
.