planet.symphony.messages
Class NeighbourMessagePool

java.lang.Object
  extended byplanet.symphony.messages.NeighbourMessagePool

public class NeighbourMessagePool
extends java.lang.Object

The purpose of this pool is to save the memory used on the simulation, for the intensive communication with NeighbourMessages.

Author:
Jordi Pujol 21-jun-2005

Field Summary
static int createdMessages
          Number of created NeighbourMessages.
static int freeMessages
          Number of free NeighbourMessages.
static int reusedMessages
          Number of reused NeighbourMessages.
 
Constructor Summary
NeighbourMessagePool()
           
 
Method Summary
static void freeMessage(NeighbourMessage msg)
          Free the unused NeighbourMessage msg
static NeighbourMessage getMessage()
          Returns an existing NeighbourMessage if exists or a new NeighbourMessage.
static NeighbourMessage getMessage(java.util.Collection value)
          Returns an existing or a new NeighbourMessage with the specified internal value.
static void init()
          Initializes the pool of NeighbourMessages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

createdMessages

public static int createdMessages
Number of created NeighbourMessages.


reusedMessages

public static int reusedMessages
Number of reused NeighbourMessages.


freeMessages

public static int freeMessages
Number of free NeighbourMessages.

Constructor Detail

NeighbourMessagePool

public NeighbourMessagePool()
Method Detail

init

public static void init()
Initializes the pool of NeighbourMessages.


getMessage

public static NeighbourMessage getMessage()
Returns an existing NeighbourMessage if exists or a new NeighbourMessage.

Returns:
An existing or a new NeighbourMessage.

getMessage

public static NeighbourMessage getMessage(java.util.Collection value)
Returns an existing or a new NeighbourMessage with the specified internal value.

Parameters:
value - The internal value for the NeighbourMessage.
Returns:
An existing or a new NeighbourMessage with the specified internal value.

freeMessage

public static void freeMessage(NeighbourMessage msg)
Free the unused NeighbourMessage msg

Parameters:
msg - An unused NeighbourMessage.