Class HROTSymbiosis
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.symbiosis.HROTSymbiosis
- All Implemented Interfaces:
ApgtableGeneratable
,MinMaxRuleable
,java.lang.Cloneable
public class HROTSymbiosis extends HROT implements ApgtableGeneratable
Represents a HROT Symbiosis rule where opposite states mutually stablise each other.
-
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 HROTSymbiosis()
Creates a HROT Symbiosis rule with the rule Minibugs SymbiosisHROTSymbiosis(java.lang.String rulestring)
Creates a HROT Symbiosis 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 ruleprotected void
fromRulestring(java.lang.String rulestring)
Loads the rule's parameters from a rulestringRuleDirective[]
generateApgtable()
Generates an apgtable for apgsearch to usejava.lang.String
getDescription()
Returns a plain text description of the HROT Symbiosis 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, dependsOnNeighbours, getAlternatingPeriod, getBoundedGrid, getColour, getNeighbourhood, getNumStates, getTiling, setBackground, setBoundedGrid, setReadingOrder, step
-
Constructor Details
-
HROTSymbiosis
public HROTSymbiosis()Creates a HROT Symbiosis rule with the rule Minibugs Symbiosis -
HROTSymbiosis
public HROTSymbiosis(java.lang.String rulestring)Creates a HROT Symbiosis rule with the specified rulestring- Parameters:
rulestring
- The rulestring of the symbiosis 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 Symbiosis rule (eg. B3/S23Symbiosis, R2,C2,S6-9,B7-8,NMSymbiosis)- 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 HROT Symbiosis rule family to be displayed in the Rule Dialog- Overrides:
getDescription
in classHROT
- Returns:
- Description of the HROT Symbiosis 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
-
clone
public java.lang.Object clone()Description copied from class:HROT
Clones the rule
-