Class Ruletree
java.lang.Object
application.model.rules.ruleloader.Directive
application.model.rules.ruleloader.RuleDirective
application.model.rules.ruleloader.ruletree.Ruletree
- All Implemented Interfaces:
Exportable
public class Ruletree extends RuleDirective implements Exportable
Implements Golly ruletrees with additional features such as arbitary neighbourhoods.
See http://golly.sourceforge.net/Help/formats.html for more information.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Ruletree(java.lang.String content)
Constructs a ruletree with the provided content -
Method Summary
Modifier and Type Method Description java.lang.Object
clone()
Deep copies the directivejava.lang.String
export()
Exports the directive to Golly / LifelibCoordinate[]
getNeighbourhood()
This method returns the neighbourhood of a given cellvoid
parseContent(java.lang.String content)
Parses the content of the ruletreeint
transitionFunc(int[] neighbours, int cellState)
This method represents the transition function of the ruleMethods inherited from class application.model.rules.ruleloader.RuleDirective
getNeighbourhood, getNumStates, getStateWeights, getSymmetry, getTiling, getTiling, getWeights
-
Constructor Details
-
Ruletree
public Ruletree(java.lang.String content)Constructs a ruletree with the provided content- Parameters:
content
- Content to use to construct the ruletree
-
-
Method Details
-
parseContent
public void parseContent(java.lang.String content)Parses the content of the ruletree- Specified by:
parseContent
in classDirective
- Parameters:
content
- The content of the ruletree
-
getNeighbourhood
Description copied from class:RuleDirective
This method returns the neighbourhood of a given cell- Specified by:
getNeighbourhood
in classRuleDirective
- Returns:
- A list of Coordinates that represent the neighbourhood
-
transitionFunc
public int transitionFunc(int[] neighbours, int cellState)Description copied from class:RuleDirective
This method represents the transition function of the rule- Specified by:
transitionFunc
in classRuleDirective
- Parameters:
neighbours
- The cell's neighbours in the order of the neighbourhood providedcellState
- The current state of the cell- Returns:
- The state of the cell in the next generation
-
clone
public java.lang.Object clone()Description copied from class:Directive
Deep copies the directive -
export
public java.lang.String export()Description copied from interface:Exportable
Exports the directive to Golly / Lifelib- Specified by:
export
in interfaceExportable
- Returns:
- The exported directive to be parsed by Golly or Lifelib
-