|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.msd.Memory
public final class Memory
Encapsulates the memory needed for an atomic discriminator. A
Memory can only be used by one thread at a time, and it
should be reused as much as possible, as it allocates a significant
amount of memory. A good strategy, is to create one Memory
per thread, and let all the discriminators of a particular thread use
the Memory designated for that thread. This is done by
passing the Memory object to the constructor of the
discriminator. If only one thread is needed, use the
getMemory method of DiscriminatorFactory.
| Field Summary | |
|---|---|
static int |
CAPACITY
The size of the dictionary and used arrays. |
List[] |
dictionary
A dictionary array of size CAPACITY for use during discrimination. |
int[] |
used
An array of size CAPACITY to keep track of which indexes in
dictionary is used. |
| Constructor Summary | |
|---|---|
Memory()
Creates a new Memory that allocates a large amount of memory. |
|
| Method Summary | ||
|---|---|---|
|
discriminate(List<? extends U> values,
IntExtractor<U,S> e)
Convenience method to easily use the Memory's dictionary. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CAPACITY
dictionary and used arrays.
public final List[] dictionary
CAPACITY for use during discrimination.
After each discrimination all entries in this array must be null.
public final int[] used
CAPACITY to keep track of which indexes in
dictionary is used.
| Constructor Detail |
|---|
public Memory()
Memory that allocates a large amount of memory.
| Method Detail |
|---|
public <U,S> Collection<List<S>> discriminate(List<? extends U> values,
IntExtractor<U,S> e)
Memory's dictionary.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||