Class Oscillator

All Implemented Interfaces:
java.lang.Iterable<Block>, java.util.Iterator<Block>

public class Oscillator
extends Pattern
Represents an oscillator
  • Constructor Details

    • Oscillator

      public Oscillator​(Rule rule, Grid pattern, int period)
      Constructs an oscillator
      Parameters:
      rule - The rule the oscillator works in
      pattern - The oscillator's pattern
      period - The period of the oscillator
  • Method Details

    • setPhases

      public void setPhases​(Grid[] grids)
      Overrides:
      setPhases in class Pattern
    • toString

      public java.lang.String toString()
      Specified by:
      toString in class Pattern
    • additionalInfo

      public java.util.Map<java.lang.String,​java.lang.String> additionalInfo()
      Additional information about the oscillator. Namely the period, minimum rule and maximum rule
      Specified by:
      additionalInfo in class Pattern
      Returns:
      A map containing the additional information about the oscillator
    • equals

      public boolean equals​(java.lang.Object o)
      Description copied from class: Grid
      Check if the inputted grid is equal to this grid (independent of translation)
      Overrides:
      equals in class Grid
      Parameters:
      o - The other grid
      Returns:
      Returns true if the grids are equal, false if they aren't
    • hashCode

      public int hashCode()
      Description copied from class: Grid
      Gets the hash of the grid.
      Overrides:
      hashCode in class Grid
      Returns:
      Returns the grid's hash (uses Golly's hash algorithm).
    • getPeriod

      public int getPeriod()
      Returns the period of the oscillator
      Returns:
      Returns the period of the oscillator
    • getPopulationSequence

      public java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getPopulationSequence()
      Gets the population sequence of the spaceship
      Returns:
      Returns the population sequence of the spaceship