Class BaseHROT

java.lang.Object
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DeficientHROT, HROT, HROTBSFKL, HROTExtendedGenerations, HROTGenerations, HROTRegeneratingGenerations, IntegerHROT, MultistateCyclicHROT

public abstract class BaseHROT
extends RuleFamily
The base class of all HROT rules
  • Field Details

    • weights

      protected int[] weights
      Weights of the HROT rule
    • neighbourhood

      protected Coordinate[] neighbourhood
      Neighbourhood of the HROT rule
    • hrotTransitions

      protected static final java.lang.String hrotTransitions
      The regex for HROT birth / survival / whatever transitions
      See Also:
      Constant Field Values
    • neighbourhoodRegex

      protected static final java.lang.String neighbourhoodRegex
      The regex for the HROT neighbourhood specifier
    • maxNeighbourhoodCount

      protected int maxNeighbourhoodCount
      The maximum possible neighbourhood count. Used for B0 and min, max rule generation.
  • Constructor Details

  • Method Details

    • generateComments

      public java.lang.String[] generateComments()
      Generates comments that will be placed in the RLE. These comments represent weights. They are only generated if the neighbourhood specifier is N@ with no additional hex digits
      Overrides:
      generateComments in class RuleFamily
      Returns:
      An array of comments each starting with "#R" (eg. {"#R 1 2 3 2 1", "#R 2 4 6 4 2"}). If no additional information needs to be added return null or an empty string array.
    • loadComments

      public void loadComments​(java.lang.String[] comments)
      Loads the weights stored in the comments generated by generateComments
      Overrides:
      loadComments in class RuleFamily
      Parameters:
      comments - The comments from the RLE (all starting with #R)
    • getNeighbourhoodSpecifier

      protected java.lang.String getNeighbourhoodSpecifier​(java.lang.String rulestring)
      Gets the neighbourhood specifier from the rulestring
      Parameters:
      rulestring - The rulestring of the rule
      Returns:
      Returns the neighbourhood specifier of the rulestring
    • loadNeighbourhood

      protected void loadNeighbourhood​(int range, java.lang.String specifier)
      Loads the neighbourhood from the N... specifier
      Parameters:
      range - The range of the neighbourhood
      specifier - The specifier for the neighbourhood
    • setNeighbourhood

      public void setNeighbourhood​(Coordinate[] neighbourhood)
      Sets the neighbourhood of the HROT rule
      Parameters:
      neighbourhood - Neighbourhood of the HROT rule
    • setWeights

      public void setWeights​(int[] weights)
      Sets the weights of the HROT rule
      Parameters:
      weights - Weights of the HROT rule
    • getNeighbourhood

      public Coordinate[] getNeighbourhood​(int generation)
      This method returns the neighbourhood of a given cell at a certain generation
      Specified by:
      getNeighbourhood in class Rule
      Parameters:
      generation - The generation of the simulation
      Returns:
      A list of Coordinates that represent the neighbourhood
    • getWeights

      public int[] getWeights()
      Gets the weights of the HROT rule
      Returns:
      Weights of the HROT rule
    • getRuleInfo

      public java.util.Map<java.lang.String,​java.lang.String> getRuleInfo()
      Description copied from class: RuleFamily
      Gets information about the rule
      Overrides:
      getRuleInfo in class RuleFamily
      Returns:
      Returns information about the rule in a map