CTL
Class ObjectMap

java.lang.Object
  extended by CTL.ObjectMap

public class ObjectMap
extends java.lang.Object

Map of objects


Field Summary
private  int counter
          Number of objects created by this map
private  java.util.LinkedList<ObjectMapEntry> list
          Underlying LinkedList of ObjectMapEntries
 
Constructor Summary
ObjectMap()
          Generate a new map
 
Method Summary
 int createObj(java.lang.reflect.Constructor c, java.lang.Object[] args)
          Create an object and insert it into the map
 java.lang.String dump()
          Dump the map's contents to screen
 int getCounter()
          Retrieve the number of generated objects
 java.lang.Object getObj(int hash)
          Retrieve an object by ID
 int regObj(java.lang.Object obj)
          Register a previously constructed object
 int regObj(java.lang.Object obj, int ID)
          Register a previously constructed object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

counter

private int counter
Number of objects created by this map


list

private java.util.LinkedList<ObjectMapEntry> list
Underlying LinkedList of ObjectMapEntries

Constructor Detail

ObjectMap

public ObjectMap()
Generate a new map

Method Detail

getCounter

public int getCounter()
Retrieve the number of generated objects

Returns:
Number of objects

createObj

public int createObj(java.lang.reflect.Constructor c,
                     java.lang.Object[] args)
              throws java.lang.InstantiationException,
                     java.lang.IllegalAccessException,
                     java.lang.reflect.InvocationTargetException
Create an object and insert it into the map

Parameters:
c - Constructor to call
args - Arguments to the constructor
Returns:
ID of the created object
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

regObj

public int regObj(java.lang.Object obj)
Register a previously constructed object

Parameters:
obj - Object
Returns:
ID of the enqueued object

regObj

public int regObj(java.lang.Object obj,
                  int ID)
Register a previously constructed object

Parameters:
obj - Object
ID - ID to register the object with
Returns:
The specified ID

getObj

public java.lang.Object getObj(int hash)
Retrieve an object by ID

Parameters:
hash - ID
Returns:
The object or null if none was registered for the specified ID

dump

public java.lang.String dump()
Dump the map's contents to screen