Class HROTHistory
java.lang.Object
application.model.rules.Rule
application.model.rules.RuleFamily
application.model.rules.hrot.BaseHROT
application.model.rules.hrot.HROT
application.model.rules.hrot.history.HROTHistory
- All Implemented Interfaces:
ApgtableGeneratable
,MinMaxRuleable
,java.lang.Cloneable
public class HROTHistory extends HROT implements ApgtableGeneratable
Represents a HROT History rule.
-
Field Summary
Fields inherited from class application.model.rules.hrot.HROT
birth, maxNeighbourhoodCount, survival
Fields inherited from class application.model.rules.hrot.BaseHROT
hrotTransitions, neighbourhood, neighbourhoodRegex, weights
Fields inherited from class application.model.rules.Rule
alternatingPeriod, background, boundedGrid, numStates, readingOrder, tiling
-
Constructor Summary
Constructors Constructor Description HROTHistory()
Creates a HROT History rule with the rule Minibugs HistoryHROTHistory(java.lang.String rulestring)
Creates a HROT History rule with the specified rulestring -
Method Summary
Modifier and Type Method Description java.lang.String
canonise(java.lang.String rulestring)
Canonises the inputted rulestring with the currently loaded parameters.java.lang.Object
clone()
Clones the ruleint
dependsOnNeighbours(int state, int generation, Coordinate coordinate)
If the next state of the cell depends on its neighbours, return -1.protected void
fromRulestring(java.lang.String rulestring)
Loads the rule's parameters from a rulestringRuleDirective[]
generateApgtable()
Generates an apgtable for apgsearch to usejavafx.scene.paint.Color
getColour(int state)
Returns the colour of a cell of the provided statejava.lang.String
getDescription()
Returns a plain text description of the 2-state HROT History rule family to be displayed in the Rule Dialogjava.lang.String[]
getRegex()
The regexes that will match a valid rulestringint
transitionFunc(int[] neighbours, int cellState, int generations, Coordinate coordinate)
This method represents the transition function of the ruleMethods inherited from class application.model.rules.hrot.HROT
betweenMinMax, getBirth, getMinMaxRule, getName, getSurvival, randomise, setBirth, setSurvival, updateBackground, validMinMax
Methods inherited from class application.model.rules.hrot.BaseHROT
generateComments, getNeighbourhood, getNeighbourhoodSpecifier, getRuleInfo, getWeights, loadComments, loadNeighbourhood, setNeighbourhood, setWeights
Methods inherited from class application.model.rules.RuleFamily
equals, getName, getNeighbourList, getRulestring, hashCode, setRulestring, toString
Methods inherited from class application.model.rules.Rule
convertState, getAlternatingPeriod, getBoundedGrid, getNeighbourhood, getNumStates, getTiling, setBackground, setBoundedGrid, setReadingOrder, step
-
Constructor Details
-
HROTHistory
public HROTHistory()Creates a HROT History rule with the rule Minibugs History -
HROTHistory
public HROTHistory(java.lang.String rulestring)Creates a HROT History rule with the specified rulestring- Parameters:
rulestring
- The rulestring of the history rule
-
-
Method Details
-
fromRulestring
protected void fromRulestring(java.lang.String rulestring) throws java.lang.IllegalArgumentExceptionLoads the rule's parameters from a rulestring- Overrides:
fromRulestring
in classHROT
- Parameters:
rulestring
- The rulestring of the HROT History rule (eg. B3/S23History, R2,C2,S6-9,B7-8,NMHistory)- Throws:
java.lang.IllegalArgumentException
- Thrown if an invalid rulestring is passed in
-
canonise
public java.lang.String canonise(java.lang.String rulestring)Canonises the inputted rulestring with the currently loaded parameters. -
getRegex
public java.lang.String[] getRegex()The regexes that will match a valid rulestring -
getDescription
public java.lang.String getDescription()Returns a plain text description of the 2-state HROT History rule family to be displayed in the Rule Dialog- Overrides:
getDescription
in classHROT
- Returns:
- Description of the 2-state HROT History rule family
-
generateApgtable
Generates an apgtable for apgsearch to use- Specified by:
generateApgtable
in interfaceApgtableGeneratable
- Overrides:
generateApgtable
in classHROT
- Returns:
- True if the operation was successful, false otherwise
-
transitionFunc
Description copied from class:Rule
This method represents the transition function of the rule- Overrides:
transitionFunc
in classHROT
- Parameters:
neighbours
- The cell's neighbours in the order of the neighbourhood providedcellState
- The current state of the cellgenerations
- The current generation of the simulationcoordinate
- The coordinate of the cell- Returns:
- The state of the cell in the next generation
-
getColour
public javafx.scene.paint.Color getColour(int state)Returns the colour of a cell of the provided state -
dependsOnNeighbours
Description copied from class:Rule
If the next state of the cell depends on its neighbours, return -1. If not return the next state of the cell.- Overrides:
dependsOnNeighbours
in classRule
- Parameters:
state
- The current state of the cellgeneration
- The generation of the simulationcoordinate
- The coordinate of the cell- Returns:
- Returns -1 or the next state of the cell
-
clone
public java.lang.Object clone()Description copied from class:HROT
Clones the rule
-