Class RandomGridAdder<T>

  • All Implemented Interfaces:
    GridAdder<T>, Adder<Grid<T>,​T>

    public class RandomGridAdder<T>
    extends Object
    implements GridAdder<T>
    This will place the added object at a random location in the space. Since the space should be adding new objects to itself automatically, this performs a move on those objects to a random location.
    • Constructor Detail

      • RandomGridAdder

        public RandomGridAdder()
    • Method Detail

      • add

        public void add​(Grid<T> space,
                        T obj)
        Adds the specified object to the space at a random location.
        Specified by:
        add in interface Adder<Grid<T>,​T>
        Parameters:
        space - the space to add the object to.
        obj - the object to add.