Package application.model.rules.hrot
Class MultistateCyclicHROT
java.lang.Object
application.model.rules.Rule
application.model.rules.RuleFamily
application.model.rules.hrot.BaseHROT
application.model.rules.hrot.MultistateCyclicHROT
- All Implemented Interfaces:
ApgtableGeneratable,java.lang.Cloneable
public class MultistateCyclicHROT extends BaseHROT implements ApgtableGeneratable
Implements the multi-state cyclic HROT rulespace
-
Field Summary
Fields inherited from class application.model.rules.hrot.BaseHROT
hrotTransitions, maxNeighbourhoodCount, neighbourhood, neighbourhoodRegex, weightsFields inherited from class application.model.rules.Rule
alternatingPeriod, background, boundedGrid, numStates, readingOrder, tiling -
Constructor Summary
Constructors Constructor Description MultistateCyclicHROT()Constructs Yoel's Gluonic ruleMultistateCyclicHROT(java.lang.String rulestring)Creates a multi-state cyclic HROT rule with the given rulestring -
Method Summary
Modifier and Type Method Description java.lang.Stringcanonise(java.lang.String rulestring)Canonises the inputted rulestring with the currently loaded parameters.java.lang.Objectclone()Clones the objectprotected voidfromRulestring(java.lang.String rulestring)Loads the rule's parameters from a rulestringRuleDirective[]generateApgtable()Generates an apgtable for apgsearch to usejava.lang.StringgetDescription()Returns a plain text description of the rule family to be displayed in the Rule Dialogjava.lang.String[]getRegex()The regexes that will match a valid rulestringinttransitionFunc(int[] neighbours, int cellState, int generations, Coordinate coordinate)This method represents the transition function of the ruleMethods inherited from class application.model.rules.hrot.BaseHROT
generateComments, getNeighbourhood, getNeighbourhoodSpecifier, getRuleInfo, getWeights, loadComments, loadNeighbourhood, setNeighbourhood, setWeightsMethods inherited from class application.model.rules.RuleFamily
equals, getName, getNeighbourList, getRulestring, hashCode, setRulestring, toString, updateBackgroundMethods inherited from class application.model.rules.Rule
convertState, dependsOnNeighbours, getAlternatingPeriod, getBoundedGrid, getColour, getName, getNeighbourhood, getNumStates, getTiling, setBackground, setBoundedGrid, setReadingOrder, step
-
Constructor Details
-
MultistateCyclicHROT
public MultistateCyclicHROT()Constructs Yoel's Gluonic rule -
MultistateCyclicHROT
public MultistateCyclicHROT(java.lang.String rulestring)Creates a multi-state cyclic HROT rule with the given rulestring- Parameters:
rulestring- The rulestring of the multi-state cyclic HROT rule to be created- Throws:
java.lang.IllegalArgumentException- Thrown if the rulestring is invalid
-
-
Method Details
-
fromRulestring
protected void fromRulestring(java.lang.String rulestring)Description copied from class:RuleFamilyLoads the rule's parameters from a rulestring- Specified by:
fromRulestringin classRuleFamily- Parameters:
rulestring- The rulestring of the rule (eg. B3/S23, R2,C2,S5-9,B7-8,NM)
-
canonise
public java.lang.String canonise(java.lang.String rulestring)Description copied from class:RuleFamilyCanonises the inputted rulestring with the currently loaded parameters. This method should be called whenever the parameters of a rule are updated.- Specified by:
canonisein classRuleFamily- Parameters:
rulestring- The rulestring to canonised- Returns:
- Canonised rulestring
-
getRegex
public java.lang.String[] getRegex()Description copied from class:RuleFamilyThe regexes that will match a valid rulestring- Specified by:
getRegexin classRuleFamily- Returns:
- An array of regexes that will match a valid rulestring
-
getDescription
public java.lang.String getDescription()Description copied from class:RuleFamilyReturns a plain text description of the rule family to be displayed in the Rule Dialog- Specified by:
getDescriptionin classRuleFamily- Returns:
- Description of the rule family
-
generateApgtable
Description copied from interface:ApgtableGeneratableGenerates an apgtable for apgsearch to use- Specified by:
generateApgtablein interfaceApgtableGeneratable- Returns:
- Returns an array of rule directives to be placed in the ruletable
- Throws:
java.lang.UnsupportedOperationException
-
clone
public java.lang.Object clone()Description copied from class:RuleFamilyClones the object- Specified by:
clonein classRuleFamily- Returns:
- A deepcopy of the object
-
transitionFunc
Description copied from class:RuleThis method represents the transition function of the rule- Specified by:
transitionFuncin classRule- 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
-