Package application.model.patterns
Class Spaceship
java.lang.Object
application.model.simulation.Grid
application.model.simulation.Simulator
application.model.patterns.Pattern
application.model.patterns.Spaceship
public class Spaceship extends Pattern
Represents a spaceship
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
additionalInfo()
Additional information about the spaceship.boolean
equals(java.lang.Object o)
Check if the inputted grid is equal to this grid (independent of translation)int
getDisplacementX()
Gets the displacement of the spaceship in the x-directionint
getDisplacementY()
Gets the displacement of the spaceship in the y-directionint
getPeriod()
Gets the period of the spaceshipjava.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
-
Spaceship
Constructs a spaceship- Parameters:
rule
- The rule the spaceship works inpattern
- The pattern of the spaceshipperiod
- The period of the spaceshipdisplacementX
- The horizontal displacement of the spaceshipdisplacementY
- The vertical displacement of the spaceship
-
-
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 spaceship. Namely the period, horizontal and vertical displacement and the minimum and maximum rule.- Specified by:
additionalInfo
in classPattern
- Returns:
- Returns a map containing the additional information about the spaceship
-
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()Gets the period of the spaceship- Returns:
- Returns the period of the spaceship
-
getDisplacementX
public int getDisplacementX()Gets the displacement of the spaceship in the x-direction- Returns:
- Returns the displacement of the spaceship in the x-direction
-
getDisplacementY
public int getDisplacementY()Gets the displacement of the spaceship in the y-direction- Returns:
- Returns the displacement of the spaceship in the y-direction
-
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
-