uk.ac.leeds.ccg.andyt.projects.genesis.core
Class GENESIS_AgentEnvironment

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler
      extended by uk.ac.leeds.ccg.andyt.projects.genesis.core.GENESIS_AgentEnvironment
All Implemented Interfaces:
java.io.Serializable, GENESIS_OutOfMemoryErrorHandlerInterface

public class GENESIS_AgentEnvironment
extends uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler
implements java.io.Serializable, GENESIS_OutOfMemoryErrorHandlerInterface

See Also:
Serialized Form

Field Summary
protected  GENESIS_AgentCollectionManager _AgentCollectionManager
           
protected  java.io.File _Directory
           
 GENESIS_Environment _GENESIS_Environment
           
protected  GENESIS_PersonFactory _PersonFactory
           
 
Fields inherited from class uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler
_Generic_TestMemory, _HandleOutOfMemoryError_boolean, _MemoryReserve, Default_Memory_Threshold, HandleOutOfMemoryErrorFalse, HandleOutOfMemoryErrorTrue
 
Fields inherited from interface uk.ac.leeds.ccg.andyt.projects.genesis.core.GENESIS_OutOfMemoryErrorHandlerInterface
serialVersionUID
 
Constructor Summary
GENESIS_AgentEnvironment()
          Default constructor
GENESIS_AgentEnvironment(GENESIS_AgentEnvironment a_GENESIS_AgentEnvironment)
          For creating a deep copy of toDeepCopy_GENESIS_AgentEnvironment This is not straight forward because of the linked references between toDeepCopy_GENESIS_AgentEnvironment._GENESIS_Environment and toDeepCopy_GENESIS_AgentEnvironment._GENESIS_Environment._GENESIS_AgentEnvironment
GENESIS_AgentEnvironment(GENESIS_Environment a_GENESIS_Environment)
           
GENESIS_AgentEnvironment(GENESIS_Environment a_GENESIS_Environment, GENESIS_AgentEnvironment a_GENESIS_AgentEnvironment)
           
 
Method Summary
protected  GENESIS_AgentCollectionManager get_AgentCollectionManager()
           
 GENESIS_AgentCollectionManager get_AgentCollectionManager(boolean handleOutOfMemoryError)
           
 java.io.File get_Directory()
           
 long init_MemoryReserve_Account(boolean handleOutOfMemoryError)
           
 long init_MemoryReserve_Account(GENESIS_FemaleCollection a_GENESIS_FemaleCollection, boolean handleOutOfMemoryError)
           
 long init_MemoryReserve_Account(GENESIS_MaleCollection a_GENESIS_MaleCollection, boolean handleOutOfMemoryError)
           
 java.lang.Object[] init_MemoryReserve_AccountDetail(boolean handleOutOfMemoryError)
           
 java.lang.Object[] init_MemoryReserve_AccountDetail(GENESIS_FemaleCollection a_GENESIS_FemaleCollection, boolean handleOutOfMemoryError)
           
 java.lang.Object[] init_MemoryReserve_AccountDetail(GENESIS_MaleCollection a_GENESIS_MaleCollection, boolean handleOutOfMemoryError)
           
 void init_MemoryReserve(boolean handleOutOfMemoryError)
          Initialises _MemoryReserve.
protected  void set_AgentCollectionManager(GENESIS_AgentCollectionManager _AgentCollectionManager)
           
 void set_AgentCollectionManager(GENESIS_AgentCollectionManager a_GENESIS_AgentCollectionManager, boolean handleOutOfMemoryError)
           
 boolean swapToFile_DataAny()
           
 boolean swapToFile_DataAny(boolean handleOutOfMemoryError)
           
protected  java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_Account()
          To try to ensure there is enough memory to continue whilst accounting a tally of the number of AgentCollections swapped to disk.
 long tryToEnsureThereIsEnoughMemoryToContinue_Account(boolean handleOutOfMemoryError)
           
protected  java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_FemaleCollection a_GENESIS_FemaleCollection)
          A method to ensure there is enough memory to continue whilst not swapping to disk a_AgentCollection and accounting by returning a HashSet identifying which AgentCollections have been swapped in the process.
 long tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_FemaleCollection a_GENESIS_FemaleCollection, boolean handleOutOfMemoryError)
           
protected  java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_MaleCollection a_GENESIS_MaleCollection)
          A method to ensure there is enough memory to continue whilst not swapping to disk a_AgentCollection and accounting by returning a HashSet identifying which AgentCollections have been swapped in the process.
 long tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_MaleCollection a_GENESIS_MaleCollection, boolean handleOutOfMemoryError)
           
protected  java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail()
          A method to ensure there is enough memory to continue whilst accounting by returning a HashSet identifying which AgentCollections have been swapped in the process.
 java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(boolean handleOutOfMemoryError)
          A method to ensure there is enough memory to continue that returns a HashSet identifying any AgentCollections swapped in the process.
protected  java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_FemaleCollection a_FemaleCollection)
           
 java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_FemaleCollection a_GENESIS_FemaleCollection, boolean handleOutOfMemoryError)
          A method to ensure there is enough memory to continue whilst not swapping to disk a_FemaleCollection
protected  java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_MaleCollection a_MaleCollection)
           
 java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_MaleCollection a_GENESIS_MaleCollection, boolean handleOutOfMemoryError)
          A method to ensure there is enough memory to continue whilst not swapping to disk a_MaleCollection
protected  boolean tryToEnsureThereIsEnoughMemoryToContinue()
           
 boolean tryToEnsureThereIsEnoughMemoryToContinue(boolean handleOutOfMemoryError)
          A method to try to ensure there is enough memory to continue.
protected  boolean tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_FemaleCollection a_FemaleCollection)
          A method to try to ensure there is enough memory to continue whilst not swapping to disk a_FemaleCollection.
 void tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_FemaleCollection a_FemaleCollection, boolean handleOutOfMemoryError)
          A method to try to ensure there is enough memory to continue.
protected  boolean tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_MaleCollection a_MaleCollection)
          A method to try to ensure there is enough memory to continue whilst not swapping to disk a_MaleCollection.
 void tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_MaleCollection a_MaleCollection, boolean handleOutOfMemoryError)
          A method to try to ensure there is enough memory to continue.
 
Methods inherited from class uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler
clear_MemoryReserve, get_Generic_TestMemory, get_MemoryReserve, getRuntime, getTotalFreeMemory, getTotalFreeMemory, init_MemoryReserve, init_MemoryReserve, initFile, initFile, initFileDirectory, initString, initString, println, set_MemoryReserve, sin, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_GENESIS_Environment

public transient GENESIS_Environment _GENESIS_Environment

_AgentCollectionManager

protected transient GENESIS_AgentCollectionManager _AgentCollectionManager

_Directory

protected java.io.File _Directory

_PersonFactory

protected GENESIS_PersonFactory _PersonFactory
Constructor Detail

GENESIS_AgentEnvironment

public GENESIS_AgentEnvironment()
Default constructor


GENESIS_AgentEnvironment

public GENESIS_AgentEnvironment(GENESIS_AgentEnvironment a_GENESIS_AgentEnvironment)
For creating a deep copy of toDeepCopy_GENESIS_AgentEnvironment This is not straight forward because of the linked references between toDeepCopy_GENESIS_AgentEnvironment._GENESIS_Environment and toDeepCopy_GENESIS_AgentEnvironment._GENESIS_Environment._GENESIS_AgentEnvironment

Parameters:
toDeepCopy_GENESIS_AgentEnvironment -

GENESIS_AgentEnvironment

public GENESIS_AgentEnvironment(GENESIS_Environment a_GENESIS_Environment,
                                GENESIS_AgentEnvironment a_GENESIS_AgentEnvironment)

GENESIS_AgentEnvironment

public GENESIS_AgentEnvironment(GENESIS_Environment a_GENESIS_Environment)
Method Detail

get_AgentCollectionManager

public GENESIS_AgentCollectionManager get_AgentCollectionManager(boolean handleOutOfMemoryError)

get_AgentCollectionManager

protected GENESIS_AgentCollectionManager get_AgentCollectionManager()

set_AgentCollectionManager

public void set_AgentCollectionManager(GENESIS_AgentCollectionManager a_GENESIS_AgentCollectionManager,
                                       boolean handleOutOfMemoryError)

set_AgentCollectionManager

protected void set_AgentCollectionManager(GENESIS_AgentCollectionManager _AgentCollectionManager)

init_MemoryReserve

public void init_MemoryReserve(boolean handleOutOfMemoryError)
Initialises _MemoryReserve.

Specified by:
init_MemoryReserve in interface GENESIS_OutOfMemoryErrorHandlerInterface
Overrides:
init_MemoryReserve in class uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler
Parameters:
_HandleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

init_MemoryReserve_Account

public long init_MemoryReserve_Account(boolean handleOutOfMemoryError)

init_MemoryReserve_AccountDetail

public java.lang.Object[] init_MemoryReserve_AccountDetail(boolean handleOutOfMemoryError)

init_MemoryReserve_Account

public long init_MemoryReserve_Account(GENESIS_FemaleCollection a_GENESIS_FemaleCollection,
                                       boolean handleOutOfMemoryError)

init_MemoryReserve_Account

public long init_MemoryReserve_Account(GENESIS_MaleCollection a_GENESIS_MaleCollection,
                                       boolean handleOutOfMemoryError)

init_MemoryReserve_AccountDetail

public java.lang.Object[] init_MemoryReserve_AccountDetail(GENESIS_FemaleCollection a_GENESIS_FemaleCollection,
                                                           boolean handleOutOfMemoryError)

init_MemoryReserve_AccountDetail

public java.lang.Object[] init_MemoryReserve_AccountDetail(GENESIS_MaleCollection a_GENESIS_MaleCollection,
                                                           boolean handleOutOfMemoryError)

tryToEnsureThereIsEnoughMemoryToContinue

public boolean tryToEnsureThereIsEnoughMemoryToContinue(boolean handleOutOfMemoryError)
A method to try to ensure there is enough memory to continue.

Specified by:
tryToEnsureThereIsEnoughMemoryToContinue in interface GENESIS_OutOfMemoryErrorHandlerInterface
Specified by:
tryToEnsureThereIsEnoughMemoryToContinue in class uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler
Parameters:
handleOutOfMemoryError -

tryToEnsureThereIsEnoughMemoryToContinue

protected boolean tryToEnsureThereIsEnoughMemoryToContinue()
Specified by:
tryToEnsureThereIsEnoughMemoryToContinue in class uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler

tryToEnsureThereIsEnoughMemoryToContinue

public void tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_FemaleCollection a_FemaleCollection,
                                                     boolean handleOutOfMemoryError)
A method to try to ensure there is enough memory to continue.

Parameters:
handleOutOfMemoryError -

tryToEnsureThereIsEnoughMemoryToContinue

public void tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_MaleCollection a_MaleCollection,
                                                     boolean handleOutOfMemoryError)
A method to try to ensure there is enough memory to continue.

Parameters:
handleOutOfMemoryError -

tryToEnsureThereIsEnoughMemoryToContinue

protected boolean tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_FemaleCollection a_FemaleCollection)
A method to try to ensure there is enough memory to continue whilst not swapping to disk a_FemaleCollection.

Parameters:
a_FemaleCollection - An FemaleCollection not to be swapped.

tryToEnsureThereIsEnoughMemoryToContinue

protected boolean tryToEnsureThereIsEnoughMemoryToContinue(GENESIS_MaleCollection a_MaleCollection)
A method to try to ensure there is enough memory to continue whilst not swapping to disk a_MaleCollection.

Parameters:
a_MaleCollection - An MaleCollection not to be swapped.

tryToEnsureThereIsEnoughMemoryToContinue_Account

public long tryToEnsureThereIsEnoughMemoryToContinue_Account(boolean handleOutOfMemoryError)

tryToEnsureThereIsEnoughMemoryToContinue_Account

protected java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_Account()
To try to ensure there is enough memory to continue whilst accounting a tally of the number of AgentCollections swapped to disk.

Returns:
An Object[] of size 2 where the first element is a boolean indicating the success of trying to ensure if there is enough memory to continue and the second element being a count of the total number of agent collections swapped in the process.

tryToEnsureThereIsEnoughMemoryToContinue_Account

public long tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_FemaleCollection a_GENESIS_FemaleCollection,
                                                             boolean handleOutOfMemoryError)

tryToEnsureThereIsEnoughMemoryToContinue_Account

public long tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_MaleCollection a_GENESIS_MaleCollection,
                                                             boolean handleOutOfMemoryError)

tryToEnsureThereIsEnoughMemoryToContinue_Account

protected java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_FemaleCollection a_GENESIS_FemaleCollection)
A method to ensure there is enough memory to continue whilst not swapping to disk a_AgentCollection and accounting by returning a HashSet identifying which AgentCollections have been swapped in the process.

Parameters:
a_AgentCollection - An AgentCollection not to be swapped.
Returns:
A HashSet of identifiers for AgentCollections swapped or null if none are swapped

tryToEnsureThereIsEnoughMemoryToContinue_Account

protected java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_Account(GENESIS_MaleCollection a_GENESIS_MaleCollection)
A method to ensure there is enough memory to continue whilst not swapping to disk a_AgentCollection and accounting by returning a HashSet identifying which AgentCollections have been swapped in the process.

Parameters:
a_AgentCollection - An AgentCollection not to be swapped.
Returns:
A HashSet of identifiers for AgentCollections swapped or null if none are swapped

tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail

public java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(boolean handleOutOfMemoryError)
A method to ensure there is enough memory to continue that returns a HashSet identifying any AgentCollections swapped in the process.

Parameters:
handleOutOfMemoryError -
Returns:
A HashSet of identifiers for AgentCollections swapped or null if no AgentCollections are swapped.

tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail

protected java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail()
A method to ensure there is enough memory to continue whilst accounting by returning a HashSet identifying which AgentCollections have been swapped in the process.

Returns:
A Object[] of size 3 with the first element being a Boolean indicating the success of reaching the target. The second element is for a HashSet of identifiers for FemaleCollections swapped, but may be null if none are swapped. The third element is for a HashSet of identifiers for MaleCollections swapped, but this may be null if nothing is swapped. Null is returned fast if nothing is swapped and there is enough memory to continue...

tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail

public java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_FemaleCollection a_GENESIS_FemaleCollection,
                                                                                 boolean handleOutOfMemoryError)
A method to ensure there is enough memory to continue whilst not swapping to disk a_FemaleCollection

Parameters:
a_FemaleCollection - A FemaleCollection not to be swapped.
handleOutOfMemoryError -
Returns:
A HashSet of identifiers for AgentCollections swapped or null if no AgentCollections are swapped.

tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail

public java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_MaleCollection a_GENESIS_MaleCollection,
                                                                                 boolean handleOutOfMemoryError)
A method to ensure there is enough memory to continue whilst not swapping to disk a_MaleCollection

Parameters:
a_MaleCollection - A MaleCollection not to be swapped.
handleOutOfMemoryError -
Returns:
A HashSet of identifiers for AgentCollections swapped or null if no AgentCollections are swapped.

tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail

protected java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_FemaleCollection a_FemaleCollection)

tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail

protected java.lang.Object[] tryToEnsureThereIsEnoughMemoryToContinue_AccountDetail(GENESIS_MaleCollection a_MaleCollection)

get_Directory

public java.io.File get_Directory()
Returns:
_Directory

swapToFile_DataAny

public boolean swapToFile_DataAny(boolean handleOutOfMemoryError)
Specified by:
swapToFile_DataAny in class uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler

swapToFile_DataAny

public boolean swapToFile_DataAny()
Specified by:
swapToFile_DataAny in class uk.ac.leeds.ccg.andyt.generic.memory.Generic_OutOfMemoryErrorHandler