fr.lifl.jedi.model.interactionSelection
Class TuplesObjectPool

java.lang.Object
  extended by fr.lifl.jedi.model.interactionSelection.TuplesObjectPool

public class TuplesObjectPool
extends java.lang.Object

This class is used to manage an object pool containing tuples.

It aims at reducing the number of garbage collections made during simulation, by managing in this class the creating of new Tuples.

Version:
JEDI V 2.3
Created the 30th June 2009
Author:
Yoann Kubera
SMAC Team (Systèmes Multi-Agents et Comportement)
LIFL (Laboratoire d'Informatique Fondamentale de Lille)
University of Lille, France

Constructor Summary
TuplesObjectPool()
           
 
Method Summary
static RealizableDegenerateTuple createRealizableDegenerateTuple(Agent source, DegenerateInteraction i)
          Creates a realizable degenerate tuple according to the values given in parameters.
static RealizableMultipleTargetTuple createRealizableMultipleTargetTuple(Agent source, MultipleTargetInteraction i)
          Creates a realizable multiple target tuple according to the values given in parameters.
static RealizableSingleTargetTuple createRealizableSingleTargetTuple(Agent source, SingleTargetInteraction i, Agent target)
          Creates a realizable single target tuple according to the values given in parameters.
static void free(AbstractRealizableTuple<?> tuple)
          Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.
static void free(java.util.List<AbstractRealizableTuple<?>> list)
          Tell the pool that a set of tuples are no more used, and can thus be used instead of creating new instances.
static void free(RealizableDegenerateTuple tuple)
          Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.
static void free(RealizableMultipleTargetTuple tuple)
          Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.
static void free(RealizableSingleTargetTuple tuple)
          Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TuplesObjectPool

public TuplesObjectPool()
Method Detail

free

public static void free(java.util.List<AbstractRealizableTuple<?>> list)
Tell the pool that a set of tuples are no more used, and can thus be used instead of creating new instances.

Parameters:
list - The set of tuples, which are no more used.

free

public static void free(AbstractRealizableTuple<?> tuple)
Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.

Parameters:
tuple - The tuple, which is no more used. Consequently, it can be used instead of creating new instances.

free

public static void free(RealizableDegenerateTuple tuple)
Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.

Parameters:
tuple - The tuple, which is no more used, and which can be used instead of creating new instances.

free

public static void free(RealizableSingleTargetTuple tuple)
Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.

Parameters:
tuple - The tuple, which is no more used, and which can be used instead of creating new instances.

free

public static void free(RealizableMultipleTargetTuple tuple)
Tell the pool that a tuple is no more used, and can thus be used instead of creating new instances.

Parameters:
tuple - The tuple, which is no more used, and which can be used instead of creating new instances.

createRealizableDegenerateTuple

public static RealizableDegenerateTuple createRealizableDegenerateTuple(Agent source,
                                                                        DegenerateInteraction i)
Creates a realizable degenerate tuple according to the values given in parameters. If an object of the pool can be used instead of creating a new object, then this object is taken from the pool.

Parameters:
source - The source of the tuple.
i - The interaction of the tuple.
Returns:
The created realizable degenerate tuple.

createRealizableSingleTargetTuple

public static RealizableSingleTargetTuple createRealizableSingleTargetTuple(Agent source,
                                                                            SingleTargetInteraction i,
                                                                            Agent target)
Creates a realizable single target tuple according to the values given in parameters. If an object of the pool can be used instead of creating a new object, then this object is taken from the pool.

Parameters:
source - The source of the tuple.
i - The interaction of the tuple.
target - The target of the tuple.
Returns:
The created realizable single target tuple.

createRealizableMultipleTargetTuple

public static RealizableMultipleTargetTuple createRealizableMultipleTargetTuple(Agent source,
                                                                                MultipleTargetInteraction i)
Creates a realizable multiple target tuple according to the values given in parameters. If an object of the pool can be used instead of creating a new object, then this object is taken from the pool.

Parameters:
source - The source of the tuple.
i - The interaction of the tuple.
Returns:
The created realizable multiple target tuple.