Class Grid2Dobject<T>

  • All Implemented Interfaces:
    Grid2D, java.io.Serializable

    public class Grid2Dobject<T>
    extends java.lang.Object
    implements Grid2D, java.io.Serializable
    a 2D Grid of objects
    See Also:
    Serialized Form
    • Field Detail

      • xDim

        public final int xDim
      • yDim

        public final int yDim
      • length

        public final int length
      • wrapX

        public boolean wrapX
      • wrapY

        public boolean wrapY
    • Constructor Detail

      • Grid2Dobject

        public Grid2Dobject​(int xDim,
                            int yDim)
        creates a new Grid2Dobject of dimensions xDim by yDim without wraparound
      • Grid2Dobject

        public Grid2Dobject​(int xDim,
                            int yDim,
                            boolean wrapX,
                            boolean wrapY)
        creates a new Grid2Dobject of dimensions xDim by yDim with optional wraparound
    • Method Detail

      • Get

        public T Get​(int i)
        gets the current field value at the specified index
      • GetField

        public T[] GetField()
      • Get

        public T Get​(int x,
                     int y)
        gets the current field value at the specified coordinates
      • Set

        public void Set​(int i,
                        T val)
        sets the current field value at the specified index
      • Set

        public void Set​(int x,
                        int y,
                        T val)
        sets the current field value at the specified coordinates
      • SetAll

        public void SetAll​(T val)
        sets all squares in the field to the specified value
      • SetAll

        public void SetAll​(T[] vals)
        copies the array of values into the field
      • Xdim

        public int Xdim()
        Specified by:
        Xdim in interface Grid2D
      • Ydim

        public int Ydim()
        Specified by:
        Ydim in interface Grid2D
      • Length

        public int Length()
        Specified by:
        Length in interface Grid2D
      • IsWrapX

        public boolean IsWrapX()
        Specified by:
        IsWrapX in interface Grid2D
      • IsWrapY

        public boolean IsWrapY()
        Specified by:
        IsWrapY in interface Grid2D