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.booleanequals(java.lang.Object o)Check if the inputted grid is equal to this grid (independent of translation)intgetPeriod()Returns the period of the oscillatorjava.util.ArrayList<java.util.ArrayList<java.lang.Integer>>getPopulationSequence()Gets the population sequence of the spaceshipinthashCode()Gets the hash of the grid.voidsetPhases(Grid[] grids)java.lang.StringtoString()Methods inherited from class application.model.patterns.Pattern
compareString, getMaxRule, getMinRule, getName, setMaxRule, setMinRuleMethods inherited from class application.model.simulation.Simulator
clearCells, getCellsChanged, getGeneration, getRule, identify, identify, identify, setCell, setCell, setGeneration, setRule, step, step, toRLEMethods 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:
additionalInfoin classPattern- Returns:
- A map containing the additional information about the oscillator
-
equals
public boolean equals(java.lang.Object o)Description copied from class:GridCheck if the inputted grid is equal to this grid (independent of translation) -
hashCode
public int hashCode()Description copied from class:GridGets 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
-