Package application.model.rules.hrot
Class BaseHROT
java.lang.Object
application.model.rules.Rule
application.model.rules.RuleFamily
application.model.rules.hrot.BaseHROT
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
DeficientHROT,HROT,HROTBSFKL,HROTExtendedGenerations,HROTGenerations,HROTRegeneratingGenerations,IntegerHROT,MultistateCyclicHROT
public abstract class BaseHROT extends RuleFamily
The base class of all HROT rules
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringhrotTransitionsThe regex for HROT birth / survival / whatever transitionsprotected intmaxNeighbourhoodCountThe maximum possible neighbourhood count.protected Coordinate[]neighbourhoodNeighbourhood of the HROT ruleprotected static java.lang.StringneighbourhoodRegexThe regex for the HROT neighbourhood specifierprotected int[]weightsWeights of the HROT ruleFields inherited from class application.model.rules.Rule
alternatingPeriod, background, boundedGrid, numStates, readingOrder, tiling -
Constructor Summary
Constructors Constructor Description BaseHROT() -
Method Summary
Modifier and Type Method Description java.lang.String[]generateComments()Generates comments that will be placed in the RLE.Coordinate[]getNeighbourhood(int generation)This method returns the neighbourhood of a given cell at a certain generationprotected java.lang.StringgetNeighbourhoodSpecifier(java.lang.String rulestring)Gets the neighbourhood specifier from the rulestringjava.util.Map<java.lang.String,java.lang.String>getRuleInfo()Gets information about the ruleint[]getWeights()Gets the weights of the HROT rulevoidloadComments(java.lang.String[] comments)Loads the weights stored in the comments generated by generateCommentsprotected voidloadNeighbourhood(int range, java.lang.String specifier)Loads the neighbourhood from the N...voidsetNeighbourhood(Coordinate[] neighbourhood)Sets the neighbourhood of the HROT rulevoidsetWeights(int[] weights)Sets the weights of the HROT ruleMethods inherited from class application.model.rules.RuleFamily
canonise, clone, equals, fromRulestring, getDescription, getName, getNeighbourList, getRegex, 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, transitionFunc
-
Field Details
-
weights
protected int[] weightsWeights of the HROT rule -
neighbourhood
Neighbourhood of the HROT rule -
hrotTransitions
protected static final java.lang.String hrotTransitionsThe regex for HROT birth / survival / whatever transitions- See Also:
- Constant Field Values
-
neighbourhoodRegex
protected static final java.lang.String neighbourhoodRegexThe regex for the HROT neighbourhood specifier -
maxNeighbourhoodCount
protected int maxNeighbourhoodCountThe maximum possible neighbourhood count. Used for B0 and min, max rule generation.
-
-
Constructor Details
-
BaseHROT
public BaseHROT()
-
-
Method Details
-
generateComments
public java.lang.String[] generateComments()Generates comments that will be placed in the RLE. These comments represent weights. They are only generated if the neighbourhood specifier is N@ with no additional hex digits- Overrides:
generateCommentsin classRuleFamily- Returns:
- An array of comments each starting with "#R" (eg. {"#R 1 2 3 2 1", "#R 2 4 6 4 2"}). If no additional information needs to be added return null or an empty string array.
-
loadComments
public void loadComments(java.lang.String[] comments)Loads the weights stored in the comments generated by generateComments- Overrides:
loadCommentsin classRuleFamily- Parameters:
comments- The comments from the RLE (all starting with #R)
-
getNeighbourhoodSpecifier
protected java.lang.String getNeighbourhoodSpecifier(java.lang.String rulestring)Gets the neighbourhood specifier from the rulestring- Parameters:
rulestring- The rulestring of the rule- Returns:
- Returns the neighbourhood specifier of the rulestring
-
loadNeighbourhood
protected void loadNeighbourhood(int range, java.lang.String specifier)Loads the neighbourhood from the N... specifier- Parameters:
range- The range of the neighbourhoodspecifier- The specifier for the neighbourhood
-
setNeighbourhood
Sets the neighbourhood of the HROT rule- Parameters:
neighbourhood- Neighbourhood of the HROT rule
-
setWeights
public void setWeights(int[] weights)Sets the weights of the HROT rule- Parameters:
weights- Weights of the HROT rule
-
getNeighbourhood
This method returns the neighbourhood of a given cell at a certain generation- Specified by:
getNeighbourhoodin classRule- Parameters:
generation- The generation of the simulation- Returns:
- A list of Coordinates that represent the neighbourhood
-
getWeights
public int[] getWeights()Gets the weights of the HROT rule- Returns:
- Weights of the HROT rule
-
getRuleInfo
public java.util.Map<java.lang.String,java.lang.String> getRuleInfo()Description copied from class:RuleFamilyGets information about the rule- Overrides:
getRuleInfoin classRuleFamily- Returns:
- Returns information about the rule in a map
-