public class Pool
extends java.lang.Object
A Pool will be organized as follows. Essentially, it is a set of objects. Let's call this set S. The pool contains an object map, which is a mapping from unique integer keys to objects in S. The pool also has a domain map, which is a mapping from concrete types to 'domains'. If the domain map maps a type T to a domain D, then D is essentially a set of objects, all should be of the type T. Each domain will be implemented as a linked list of the integer indices over the object map. Note (1): currently, only concrete types are allowed to be put in the pool (as explained above, to group the objects). Note (2): null should not be stored in the pool.
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<JType,java.util.LinkedList<java.lang.Integer>> |
domainMap |
protected java.lang.Integer |
indexOfObjectUnderTest |
protected int |
objectCount |
protected java.util.HashMap<java.lang.Integer,java.lang.Object> |
objectMap |
protected java.lang.Object |
objectUnderTest |
protected JType |
typeOfObjectUnderTest |
Constructor and Description |
---|
Pool()
Create an empty pool.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
find(java.lang.Object x)
Find an object in the pool.
|
java.lang.Object |
get(int i)
Returns the object from objectMap indexed with i; i should be an existing index.
|
java.lang.Integer |
getIndexOfObjectUnderTest() |
java.lang.Object |
getObjectUnderTest() |
JType |
getTypeOfObjectUnderTest() |
int |
markAsObjectUnderTest(java.lang.Object u)
To mark that an object in the pool is an object under test in the pool.
|
int |
put(JType ty,
java.lang.Object u)
Add an object u of concrete type ty into the pool.
|
void |
reset()
To reset the pool to its initial empty state.
|
java.lang.Integer |
rndGetIndex(JType ty)
Randomly draw an object of a concrete type ty from the pool.
|
java.lang.String |
toString() |
protected java.util.HashMap<java.lang.Integer,java.lang.Object> objectMap
protected java.util.HashMap<JType,java.util.LinkedList<java.lang.Integer>> domainMap
protected int objectCount
protected java.lang.Integer indexOfObjectUnderTest
protected java.lang.Object objectUnderTest
protected JType typeOfObjectUnderTest
public void reset()
public java.lang.Object get(int i)
public java.lang.Integer find(java.lang.Object x)
public java.lang.Integer rndGetIndex(JType ty)
public int put(JType ty, java.lang.Object u)
public int markAsObjectUnderTest(java.lang.Object u)
public java.lang.Integer getIndexOfObjectUnderTest()
public java.lang.Object getObjectUnderTest()
public JType getTypeOfObjectUnderTest()
public java.lang.String toString()
toString
in class java.lang.Object