copyright The Portico Project 2008.

org.portico.lrc
Class LRCRegionStore

java.lang.Object
  extended by org.portico.lrc.LRCRegionStore

public class LRCRegionStore
extends Object

This class maintains a list of all RegionInstance instances known to the LRC.

The RegionStore maintains a set of cloned RegionInstances, as opposed to storing direct references to the original RegionInstances. This way, when the instances are changed by a Federate, the new values are not actually used until they notify the RTI of the change.

NOTE: This class is NOT THREAD SAFE.


Field Summary
private  Map<Integer,RegionInstance> regions
           
 
Constructor Summary
LRCRegionStore()
           
 
Method Summary
 void addRegion(RegionInstance region)
          Adds the given RegionInstance to the store.
 boolean containsRegion(HLA13Region region)
          Returns true if the store contains the given HLA13Region, false otherwise.
 boolean containsRegion(int regionHandle)
          Returns true if the store contains a RegionInstance with the given handle, false otherwise.
 boolean containsRegion(Java1Region region)
          Returns true if the store contains the given Java1Region, false otherwise.
 boolean containsRegion(RegionInstance region)
          Returns true if the store contains the given RegionInstance, false otherwise.
 RegionInstance getRegion(int regionHandle)
          Fetch the contained region with the supplied region handle.
 RegionInstance removeRegion(int regionHandle)
          Remove and return the contained RegionInstance with the given handle.
 RegionInstance removeRegion(RegionInstance theRegion)
          Remove and return the contained RegionInstance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regions

private Map<Integer,RegionInstance> regions
Constructor Detail

LRCRegionStore

public LRCRegionStore()
Method Detail

addRegion

public void addRegion(RegionInstance region)
Adds the given RegionInstance to the store. If there is already a RegionInstance with the given handle within this store, that RegionInstance will be replaced with the one that is being added. If the given region is null, nothing will happen.

NOTE: When adding a RegionInstance, the actual source instance will not be stored. Rather, the instance will be cloned, and the cloned instance stored.


getRegion

public RegionInstance getRegion(int regionHandle)
Fetch the contained region with the supplied region handle. If no RegionInstance can be found with that handle, null is returned.

NOTE: The returned instance will NOT be the actual stored instance. Rather, it will be a clone of the stored instance. This way, changes made will not affect the original.


removeRegion

public RegionInstance removeRegion(int regionHandle)
Remove and return the contained RegionInstance with the given handle. If the RegionInstance exists, it will be removed and returned. If no RegionInstance with the given handle exists, null will be returned and the store will remain unaffected.

This will return the actual referenced instance, unlike the getRegion(int) method, which will return a clonse.


removeRegion

public RegionInstance removeRegion(RegionInstance theRegion)
Remove and return the contained RegionInstance. If the RegionInstance exists in the store, it will be removed and returned. If the RegionInstance doesn't exist in the collection, null will be returned and the store will remain unaffected.

This will return the actual referenced instance, unlike the getRegion(int) method, which will return a clonse.


containsRegion

public boolean containsRegion(int regionHandle)
Returns true if the store contains a RegionInstance with the given handle, false otherwise.


containsRegion

public boolean containsRegion(RegionInstance region)
Returns true if the store contains the given RegionInstance, false otherwise.


containsRegion

public boolean containsRegion(HLA13Region region)
Returns true if the store contains the given HLA13Region, false otherwise. It will actually get the wrapped RegionInstance instance inside the HLA13Region and check using that.


containsRegion

public boolean containsRegion(Java1Region region)
Returns true if the store contains the given Java1Region, false otherwise. It will actually get the wrapped RegionInstance instance inside the Java1Region and check using that.


copyright The Portico Project 2008.