Class INTTransitions
java.lang.Object
application.model.rules.isotropic.transitions.INTTransitions
- Direct Known Subclasses:
DoubleLetterTransitions
,SingleLetterTransitions
public abstract class INTTransitions
extends java.lang.Object
All INT transitions should inherit from this class
-
Field Summary
Fields Modifier and Type Field Description protected Coordinate[]
neighbourhood
The neighbourhood of the INT transitionsprotected java.util.TreeSet<java.lang.String>
sortedTransitionTable
A transition table that is sorted in lexicographical order (useful for deficient rules).protected java.lang.String
transitionString
The transition string of the INT transitionprotected java.util.HashSet<java.util.ArrayList<java.lang.Integer>>
transitionTable
The transition table with the symmetries applied -
Constructor Summary
Constructors Constructor Description INTTransitions(java.lang.String string)
Constructs INT transitions from the provided string -
Method Summary
Modifier and Type Method Description abstract void
addTransition(java.lang.String transition)
Adds an INT transitionvoid
addTransition(java.util.ArrayList<java.lang.Integer> transition)
Adds the provided transition to the transitions tableabstract java.lang.String
canoniseTransitions()
Canonises the transitions based on the currently loaded parametersboolean
checkSubset(INTTransitions transition)
Checks if this INT transition is a subset of anotherboolean
checkTransition(int[] neighbours)
Checks if the provided neighbours of the cell satisfy the INT transitionsboolean
checkTransition(java.util.ArrayList<java.lang.Integer> neighbours)
Checks if the provided neighbours of the cell satisfy the INT transitionsabstract java.lang.Object
clone()
Makes a deep copy of the INT transitionsINTTransitions
getMaxTransition()
Generates an INT transition with the maximum number of transitions possibleINTTransitions
getMinTransition()
Generates an INT transition with the minimum number of transitions possibleCoordinate[]
getNeighbourhood()
Gets the neighbourhood of the INT transitionsabstract java.lang.String
getRegex()
Gets the regex for the INT transitionsjava.util.TreeSet<java.lang.String>
getSortedTransitionTable()
Gets the sorted transitionsprotected abstract java.util.ArrayList<java.util.ArrayList<java.lang.Integer>>
getSymmetries(java.util.ArrayList<java.lang.Integer> transition)
Applies the symmetries to the required transitionsabstract java.lang.String
getTransitionsFromNeighbours(java.util.ArrayList<java.lang.Integer> neighbours)
Gets the INT transition from the neighboursjava.lang.String
getTransitionString()
Gets the transition string of the INT transitionsjava.util.HashSet<java.util.ArrayList<java.lang.Integer>>
getTransitionTable()
Gets the transition table of the INT transitionprotected abstract void
parseTransitions(java.lang.String string)
Parses transitions from the provided stringstatic INTTransitions
randomise(INTTransitions minTransitions, INTTransitions maxTransitions)
Generates a random INT transition between a min and max INT transitionabstract void
removeTransition(java.lang.String transition)
Removes an INT transitionvoid
removeTransition(java.util.ArrayList<java.lang.Integer> transition)
Remove the provided transition to the transitions tablevoid
setTransitionString(java.lang.String string)
Sets the transition string of the INT transitions
-
Field Details
-
transitionString
protected java.lang.String transitionStringThe transition string of the INT transition -
neighbourhood
The neighbourhood of the INT transitions -
transitionTable
protected java.util.HashSet<java.util.ArrayList<java.lang.Integer>> transitionTableThe transition table with the symmetries applied -
sortedTransitionTable
protected java.util.TreeSet<java.lang.String> sortedTransitionTableA transition table that is sorted in lexicographical order (useful for deficient rules). Contains all the transitions in string format (e.g. 1c, 1e, 2a, 4c, 4z, 6k...)
-
-
Constructor Details
-
INTTransitions
public INTTransitions(java.lang.String string)Constructs INT transitions from the provided string- Parameters:
string
- The string representation of the INT transitions
-
-
Method Details
-
setTransitionString
public void setTransitionString(java.lang.String string)Sets the transition string of the INT transitions- Parameters:
string
- The transition string
-
parseTransitions
protected abstract void parseTransitions(java.lang.String string)Parses transitions from the provided string- Parameters:
string
- The string representation of the INT transitions
-
canoniseTransitions
public abstract java.lang.String canoniseTransitions()Canonises the transitions based on the currently loaded parameters- Returns:
- Returns the canonised transitions in the form of a string
-
addTransition
public void addTransition(java.util.ArrayList<java.lang.Integer> transition)Adds the provided transition to the transitions table- Parameters:
transition
- The INT transition to be added
-
removeTransition
public void removeTransition(java.util.ArrayList<java.lang.Integer> transition)Remove the provided transition to the transitions table- Parameters:
transition
- The INT transition to be removed
-
getSymmetries
protected abstract java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getSymmetries(java.util.ArrayList<java.lang.Integer> transition)Applies the symmetries to the required transitions- Parameters:
transition
- The transition on which the symmetries will be applied- Returns:
- Returns the applied symmetries
-
checkTransition
public boolean checkTransition(int[] neighbours)Checks if the provided neighbours of the cell satisfy the INT transitions- Parameters:
neighbours
- Neighbours of the cell- Returns:
- Returns true if the condition is satisfied, false otherwise
-
checkTransition
public boolean checkTransition(java.util.ArrayList<java.lang.Integer> neighbours)Checks if the provided neighbours of the cell satisfy the INT transitions- Parameters:
neighbours
- Neighbours of the cell- Returns:
- Returns true if the condition is satisfied, false otherwise
-
getRegex
public abstract java.lang.String getRegex()Gets the regex for the INT transitions- Returns:
- Returns the regex for the INT transitions
-
getTransitionsFromNeighbours
public abstract java.lang.String getTransitionsFromNeighbours(java.util.ArrayList<java.lang.Integer> neighbours)Gets the INT transition from the neighbours- Parameters:
neighbours
- The neighbours of the cell- Returns:
- Returns the INT transition
-
addTransition
public abstract void addTransition(java.lang.String transition)Adds an INT transition- Parameters:
transition
- The INT transition to add
-
removeTransition
public abstract void removeTransition(java.lang.String transition)Removes an INT transition- Parameters:
transition
- The INT transition to remove
-
checkSubset
Checks if this INT transition is a subset of another- Parameters:
transition
- The INT transition to check- Returns:
- Returns true if the this INT transition is a subset of another, false otherwise
-
getNeighbourhood
Gets the neighbourhood of the INT transitions- Returns:
- Returns the neighbourhood of the INT transitions
-
getSortedTransitionTable
public java.util.TreeSet<java.lang.String> getSortedTransitionTable()Gets the sorted transitions- Returns:
- Returns the sorted transitions
-
getTransitionTable
public java.util.HashSet<java.util.ArrayList<java.lang.Integer>> getTransitionTable()Gets the transition table of the INT transition- Returns:
- Returns the transition table
-
getTransitionString
public java.lang.String getTransitionString()Gets the transition string of the INT transitions- Returns:
- Returns the transition string of the INT transitions
-
clone
public abstract java.lang.Object clone()Makes a deep copy of the INT transitions- Overrides:
clone
in classjava.lang.Object
- Returns:
- Returns the deep copy
-
randomise
public static INTTransitions randomise(INTTransitions minTransitions, INTTransitions maxTransitions)Generates a random INT transition between a min and max INT transition- Parameters:
minTransitions
- The minimum INT transitionmaxTransitions
- The maximum INT transition- Returns:
- Returns the randomised INT transition
-
getMaxTransition
Generates an INT transition with the maximum number of transitions possible- Returns:
- Returns the INT transition with the maximum number of transitions possible
-
getMinTransition
Generates an INT transition with the minimum number of transitions possible- Returns:
- Returns the INT transition with the minimum number of transitions possible
-