Interface CellAccessor<T,​U>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean allowsMultiOccupancy()  
      T get​(U locationStorage, GridPoint location)
      Gets the item at the specified location in the map.
      Iterable<T> getAll​(U locationStorage, GridPoint location)
      Gets all the items at the specified location in the map.
      T getRandom​(U locationStorage, GridPoint location)
      Gets a random item from those at the specified location in the map.
      boolean put​(T obj, U locationStorage, GridPoint location)
      Attempts to put the specified object at the specified location.
      void remove​(T obj, U locationStorage, GridPoint location)
      Removes the specified object from the location in the map.
    • Method Detail

      • put

        boolean put​(T obj,
                    U locationStorage,
                    GridPoint 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.
        Parameters:
        obj - the object to put at the location
        locationStorage - the location map to put the object in
        location - the location in the map
        Returns:
        true if the put was successful, otherwise false.
      • remove

        void remove​(T obj,
                    U locationStorage,
                    GridPoint location)
        Removes the specified object from the location in the map.
        Parameters:
        obj - the object to remove
        locationStorage - the location map to remove the object from
        location - the location in the map
      • get

        T get​(U locationStorage,
              GridPoint location)
        Gets the item at the specified location in the map.
        Parameters:
        locationStorage - the location map to put the object in
        location - the location in the map
        Returns:
        the item at the specified location
      • getAll

        Iterable<T> getAll​(U locationStorage,
                           GridPoint location)
        Gets all the items at the specified location in the map.
        Parameters:
        locationStorage - the location map to retrieve from
        location - the location in the map
        Returns:
        an iterator over all the items at the specified location
      • getRandom

        T getRandom​(U locationStorage,
                    GridPoint location)
        Gets a random item from those at the specified location in the map.
        Parameters:
        locationStorage - the location map to retrieve from
        location - the location in the map
        Returns:
        a random item at the specified location
      • allowsMultiOccupancy

        boolean allowsMultiOccupancy()
        Returns:
        true if this cell accessor allows multi occupancy, otherwise false.