Class BoundedGrid

java.lang.Object
application.model.simulation.bounds.BoundedGrid
Direct Known Subclasses:
Bounded, Torus

public abstract class BoundedGrid
extends java.lang.Object
The base class for all bounded grid types
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected int height  
    protected Coordinate initialCoordinate  
    protected java.lang.String specifier  
    protected int width  
  • Constructor Summary

    Constructors 
    Constructor Description
    BoundedGrid​(java.lang.String specifier, Coordinate initialCoordinate)
    Constructs a bounded grid
  • Method Summary

    Modifier and Type Method Description
    boolean atEdge​(Coordinate coordinate)
    Checks if a coordinate is at the edge of the bounded grid
    abstract java.lang.String canonise()
    Canonises the bounded grid specifier
    abstract java.lang.Object clone()  
    int getHeight()
    Gets the height of the bounded grid
    Coordinate getInitialCoordinate()
    Gets the initial coordinate of the bounded grid
    abstract java.lang.String[] getRegex()
    Gets the regex for the identifier string of the bounded grid
    java.lang.String getSpecifier()
    Gets the bounded grid specifier
    int getWidth()
    Gets the width of the bounded grid
    abstract Coordinate map​(Coordinate coordinate)
    Maps a coordinate to its new position
    abstract void parse​(java.lang.String string)
    Parses the identifier string of the bounded grid (e.g.
    void setInitialCoordinate​(Coordinate initialCoordinate)
    Sets the initial coordinate of the bounded grid
    void setSpecifier​(java.lang.String specifier)
    Sets the bounded grid specifier

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • BoundedGrid

      public BoundedGrid​(java.lang.String specifier, Coordinate initialCoordinate)
      Constructs a bounded grid
      Parameters:
      specifier - The bounded grid specifier
      initialCoordinate - The initial coordinate of the bounded grid
  • Method Details

    • parse

      public abstract void parse​(java.lang.String string)
      Parses the identifier string of the bounded grid (e.g. T100,50)
      Parameters:
      string - The string to parse
    • canonise

      public abstract java.lang.String canonise()
      Canonises the bounded grid specifier
      Returns:
      Returns the canonised string
    • getRegex

      public abstract java.lang.String[] getRegex()
      Gets the regex for the identifier string of the bounded grid
      Returns:
      Returns the regexes for identifying the bounded grid
    • map

      public abstract Coordinate map​(Coordinate coordinate)
      Maps a coordinate to its new position
      Parameters:
      coordinate - The coordinate to map
      Returns:
      Returns the new mapped coordinate
    • atEdge

      public boolean atEdge​(Coordinate coordinate)
      Checks if a coordinate is at the edge of the bounded grid
      Parameters:
      coordinate - Coordinate to check
      Returns:
      Returns true if the coordinate is at the edge of the bounded grid, false otherwise
    • getSpecifier

      public java.lang.String getSpecifier()
      Gets the bounded grid specifier
      Returns:
      Returns the bounded grid specifier
    • getInitialCoordinate

      public Coordinate getInitialCoordinate()
      Gets the initial coordinate of the bounded grid
      Returns:
      Returns the initial coordinate of the bounded grid
    • setSpecifier

      public void setSpecifier​(java.lang.String specifier)
      Sets the bounded grid specifier
      Parameters:
      specifier - The bounded grid specifier
    • setInitialCoordinate

      public void setInitialCoordinate​(Coordinate initialCoordinate)
      Sets the initial coordinate of the bounded grid
      Parameters:
      initialCoordinate - The initial coordinate of the bounded grid
    • getWidth

      public int getWidth()
      Gets the width of the bounded grid
      Returns:
      Returns the width of the bounded grid
    • getHeight

      public int getHeight()
      Gets the height of the bounded grid
      Returns:
      Returns the height of the bounded grid
    • clone

      public abstract java.lang.Object clone()
      Overrides:
      clone in class java.lang.Object