Enum Allocator
- java.lang.Object
-
- java.lang.Enum<Allocator>
-
- ru.ispras.microtesk.test.engine.allocator.Allocator
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BIASED
Returns a randomly chosen object.FREE
Returns a free object ornull
if all the objects are in use.RANDOM
Returns a randomly chosen free or used object.READ
Returns an object being read ornull
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 ornull
there are no such objects.WRITE
Returns an object being written ornull
if there are no such objects.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Enum Constant Detail
-
RANDOM
public static final Allocator RANDOM
Returns a randomly chosen free or used object.
-
FREE
public static final Allocator FREE
Returns a free object ornull
if all the objects are in use.
-
USED
public static final Allocator USED
Returns a used object ornull
there are no such objects.
-
READ
public static final Allocator READ
Returns an object being read ornull
if there are no such objects.
-
WRITE
public static final Allocator WRITE
Returns an object being written ornull
if there are no such objects.
-
TRY_FREE
public static final Allocator TRY_FREE
Returns a free object (if available) or a used one (otherwise).
-
TRY_USED
public static final Allocator TRY_USED
Returns a used object (if available) or a random one (otherwise).
-
TRY_READ
public static final Allocator TRY_READ
Returns an object being read (if available) or a random one (otherwise).
-
TRY_WRITE
public static final Allocator TRY_WRITE
Returns an object being written (if available) or a random one (otherwise).
-
BIASED
public static final Allocator BIASED
Returns a randomly chosen object.
-
-
Method Detail
-
values
public static Allocator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Allocator c : Allocator.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Allocator valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
next
public 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.- Type Parameters:
T
- type of objects.- Parameters:
retain
- the set of all available objects.exclude
- the set of objects to be excluded.used
- the of used objects.rate
- the dependencies biases.- Returns:
- the chosen object or
null
.
-
next
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)
Generates an object.- Type Parameters:
T
- type of objects.- Parameters:
supplier
- the object generator.exclude
- the set of objects to be excluded.used
- the set of used objects.rate
- the dependencies biases.- Returns:
- the chosen object or
null
.
-
-