Class MultiOccupancyCoordinateAccessor<T>

java.lang.Object
repast.simphony.space.continuous.MultiOccupancyCoordinateAccessor<T>
All Implemented Interfaces:
CoordinateAccessor<T,Map<NdPoint,Object>>

public class MultiOccupancyCoordinateAccessor<T> extends Object implements CoordinateAccessor<T,Map<NdPoint,Object>>
Coordinate accessor where a location can hold multiple individual objects. This uses a list to store the objects in each cell.
Author:
Nick Collier
  • Constructor Details

    • MultiOccupancyCoordinateAccessor

      public MultiOccupancyCoordinateAccessor()
  • Method Details

    • get

      public T get(Map<NdPoint,Object> locationMap, NdPoint location)
      Gets the item at the specified location in the map.
      Specified by:
      get in interface CoordinateAccessor<T,Map<NdPoint,Object>>
      Parameters:
      locationMap - the location map to put the object in
      location - the location in the map
      Returns:
      the item at the specified location
    • getAll

      public Iterable<T> getAll(Map<NdPoint,Object> locationMap, NdPoint location)
      Gets all the items at the specified location in the map.
      Specified by:
      getAll in interface CoordinateAccessor<T,Map<NdPoint,Object>>
      Parameters:
      locationMap - the location map to retrieve from
      location - the location in the map
      Returns:
      an iterator over all the items at the specified location
    • getRandom

      public T getRandom(cern.jet.random.Uniform distribution, Map<NdPoint,Object> locationMap, NdPoint location)
      Gets a random item from those at the specified location in the map.
      Specified by:
      getRandom in interface CoordinateAccessor<T,Map<NdPoint,Object>>
      Parameters:
      locationMap - the location map to retrieve from
      location - the location in the map
      Returns:
      a random item at the specified location
    • put

      public boolean put(T obj, Map<NdPoint,Object> locationMap, NdPoint location)
      Attempts to put the specified object at the specified location. Returns true if the put was successful. The semantics of the result will be determined by implementing classes.
      Specified by:
      put in interface CoordinateAccessor<T,Map<NdPoint,Object>>
      Parameters:
      obj - the object to put at the location
      locationMap - the location map to put the object in
      location - the location in the map
      Returns:
      true if the put was successful, otherwise false.
    • remove

      public void remove(T obj, Map<NdPoint,Object> locationMap, NdPoint location)
      Removes the specified object from the location in the map.
      Specified by:
      remove in interface CoordinateAccessor<T,Map<NdPoint,Object>>
      Parameters:
      obj - the object to remove
      locationMap - the location map to remove the object from
      location - the location in the map