Package application.model.patterns
Class Oscillator
java.lang.Object
application.model.simulation.Grid
application.model.simulation.Simulator
application.model.patterns.Pattern
application.model.patterns.Oscillator
public class Oscillator extends Pattern
Represents an oscillator
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Oscillator(Rule rule, Grid pattern, int period)
Constructs an oscillator -
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
additionalInfo()
Additional information about the oscillator.boolean
equals(java.lang.Object o)
Check if the inputted grid is equal to this grid (independent of translation)int
getPeriod()
Returns the period of the oscillatorjava.util.ArrayList<java.util.ArrayList<java.lang.Integer>>
getPopulationSequence()
Gets the population sequence of the spaceshipint
hashCode()
Gets the hash of the grid.void
setPhases(Grid[] grids)
java.lang.String
toString()
Methods inherited from class application.model.patterns.Pattern
compareString, getMaxRule, getMinRule, getName, setMaxRule, setMinRule
Methods inherited from class application.model.simulation.Simulator
clearCells, getCellsChanged, getGeneration, getRule, identify, identify, identify, setCell, setCell, setGeneration, setRule, step, step, toRLE
Methods inherited from class application.model.simulation.Grid
addBlock, bfs, clearCells, convertCell, deepCopy, fromApgcode, fromRLE, getBackground, getBlock, getBlockCoordinate, getBlockCoordinates, getBlocks, getBounds, getCell, getCell, getCells, getPopulation, hashCode, hashCode, hasNext, insertCells, iterateCells, iterateCellsInBlock, iterator, next, reflectCellsX, reflectCellsY, removeBlock, rotateCCW, rotateCW, setBackground, shallowCopy, size, slowEquals, toArray, toRLE, updateBounds
-
Constructor Details
-
Oscillator
Constructs an oscillator- Parameters:
rule
- The rule the oscillator works inpattern
- The oscillator's patternperiod
- The period of the oscillator
-
-
Method Details
-
setPhases
-
toString
public java.lang.String toString() -
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 classPattern
- 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) -
hashCode
public int hashCode()Description copied from class:Grid
Gets the hash of the grid. -
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
-